It's not a secret anymore!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt abt Boxing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt abt Boxing" Watch "Doubt abt Boxing" New topic

Doubt abt Boxing

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643

in above code there are two cases of boxing
in case 1:
Integer is converted to int at line 7 due to which if
returns true.So there is no doubt.
But in case 2:
if loop is making comparsion between int and Long(object)
at line 13 why if loop returns true.
i have a doubt in case 2.

please help
It is sorta covered in the JavaRanch Style Guide.
subject: Doubt abt Boxing
Similar Threads
Assertion Question from Dan's exam
Doubt in Devaka's Final Exam Question.
Kathy Sierra doubt
Integer ref1,ref2;ref1=ref2=-128; ref1==ref2 give true but for the case -129 it give false
Doubt in break and continue statements