Greetings Group,
I am confused about what is probably basic behavior re StringBuffer. I've consulted Bates and Sierra as well as Thinking In
Java and have probably found but not understood the answer to a question I've encountered on a practice exam.
Code:
1.
String x1 = "12ab";
2. StringBuffer bc = new StringBuffer("34cd");
3. byte y = 1;
4. System.out.println(x1 + y);
5. System.out.println(bc + y);
The correct answer to this practice question is that String conversion does not apply to StringBuffer.
I do not see where conversion is trying to take place for the StringBuffer object. I answered is that 12ab is printed on one line followed by 34cd on the next line.
Does not line 5 simply append the value of y and print 1abcd?
Thanks,
:-)
JerryB