the title is like this.
public class T_Three {
public void increment(int a, Integer b, String c, StringBuffer d) {
aPP;
bPP;
c = c + " world";
d.append(" world");
}
public static void main(String[] args) {
int a = 0;
Integer b = new Integer(0);
String c = "hello";
StringBuffer d = new StringBuffer("hello");
new T_Three().increment(a, b, c, d);
System.out.println("a=" + a + " b=" + b + " c=" + c + " d=" + d);
}
}
ask the result of the output
await? Baked? Che? Dumped?
then I tried it on IDE. The result of the output is
axi0 c=hello d=hello worldMay I ask why? Why didn"t the self-increase of an and b increase? Why String is not spliced, why does StringBuffer"s append work?
Stringbuffer I personally understand that what append operates is the incoming object, so it works on it.
c is not concatenated because it operates on the c of the function itself and does not affect the outer c.
but I don"t quite understand Integer and int.
I don"t know if I understand it correctly. I hope you can give me some guidance.