Santosh Ramachandrula wrote:
When I pass a primitive "int"in the second statement "does Java convert it to Integer object by "auto boxing"?
Your questions will be clearer if all the relevant details are together, rather than having to refer back 5 or 10 posts so see what you're talking about.
Are you asking if the 2 is autoboxed in
?
If so, the answer is yes. Anywhere an Integer is expected and you provide a primitive int, if it compiles, it's autoboxing. And anywhere a primitive int is expected and you provide an Integer, if it compiles, it auto-unboxing.