Why is primitive type int changed to object Integer automatically when i put primitve type int to ArrayList in java?
Why is primitive type int changed to object Integer automatically when i put primitve
Share
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.
Autoboxingautomatically convertsprimitivetypes to their appropriatewrapperobject. The reason behind it is that you can’t put a primitive into a collection. Before Java 5 came along you had to do this yourself but now this is handled automatically for you.See this link here for more details: http://docs.oracle.com/javase/1.5.0/docs/guide/language/autoboxing.html