Autoboxing seems to come down to the fact that I can write:
Integer i = 0;
instead of:
Integer i = new Integer(0);
So, the compiler can automatically convert a primitive to an Object.
Is that the idea? Why is this important?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You kind of simplified it a little too much.
Autoboxing also comes into play when using collections. As explained in sun’s java docs:
Great overview of Autoboxing