Page 1 of 1
About Question com.enthuware.ets.scjp.v6.2.610 :
Posted: Mon Feb 20, 2012 4:44 pm
by ETS User
There is declaration:
Object prevObj
And next in method u use:
prevObject
It won't compile. Please change variable name correctly.
Re: About Question com.enthuware.ets.scjp.v6.2.610 :
Posted: Mon Feb 20, 2012 5:24 pm
by admin
This has now been fixed.
Thank you for your feedback!
Re: About Question com.enthuware.ets.scjp.v6.2.610 :
Posted: Fri Feb 24, 2012 12:53 pm
by Pierluigi
Hello,
I think that the explanation to the answer #5 is not exact. The explanation states: "0 is an int (a primitive) and you cannot pass it to a method that needs an object!!!".
If the argument object is a wrapper type, then any primitive value that can be autoboxed to that wrapper type can be successfully passed as an argument.
If the object is an Object, then any primitive number (be it an int, float, double, etc..) will be implicitly autoboxed by the compiler to its corresponding wrapper type (Integer, Float, Double, etc..) and then implicitly cast to Object to match the argument type of the method.
Re: About Question com.enthuware.ets.scjp.v6.2.610 :
Posted: Sat Feb 25, 2012 11:55 pm
by admin
You are right. The explanation should mention this point. In this case though, the method parameter is List, and so auto-boxing will not occur.
This will be fixed asap.
thank you for your feedback!