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);
}
}