The Java compiler treats the previous code as if it were the following:
new StringBuffer().append(a).append(b).append(c).toString();
class MyClass {
private int a;
private int b;
private int c;
MyClass(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
public String toString() {
return "a = " + a + ", b = " + b + ", c = " + c;
}
}
public class MainClass {
public static void main(String[] argv) {
MyClass t = new MyClass(11, 13, 48);
System.out.println("Here it is: " + t);
}
}
Here it is: a = 11, b = 13, c = 48