All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
When you concatenate anything with a String, `toString()` is called on that object and then concatenation happens. Since 2 is primitive, it first Autoboxed to Integer, and then
The code `2+""`, will cause autoboxing, cause in order to concatenate primitive with string, java first transform primitive into object, and then call `toString()` on that object. So, option 5 is also correct answer.
Oh ok, I see what you mean. Yes, that is a good point. Autoboxing does happen in this case with the non string operand. Fixed.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.