📅  最后修改于: 2022-03-11 14:52:33.344000             🧑  作者: Mango
public class MyClass{
// An example class with two arbitrary attributes
private int myInt = 5;
private String myString = "Hello World";
// toString() is defined by default in Java, so the @Override is necessary
@Override
public String toString(){
// Note that the result string can be anything you want
return "MyClass Object (%s, %d)".format(this.myInt, this.myString);
}
}