There is declaration:
Object prevObj
And next in method u use:
prevObject
It won't compile. Please change variable name correctly.
About Question com.enthuware.ets.scjp.v6.2.610 :
Moderators: Site Manager, fjwalraven
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.610 :
This has now been fixed.
Thank you for your feedback!
Thank you for your feedback!
If you like our products and services, please help us by posting your review here.
-
- Posts: 8
- Joined: Thu Feb 23, 2012 5:33 am
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.610 :
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.
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.
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.610 :
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!
This will be fixed asap.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 31 guests