About Question enthuware.ocpjp.ii.v11.2.3343 :
Posted: Wed Feb 26, 2020 5:55 am
Hi)
Here is the question The question is regarding firth option
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 method is called.
p.s. If it was just - that's fine no autoboxing, cause println - overloaded method and can take primitive int.
Here is the question The question is regarding firth option
Code: Select all
System.out.println(2+"");
Code: Select all
Integer.toString
p.s. If it was just
Code: Select all
System.out.println(2);