File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Integer Wrappers Comparison doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Integer Wrappers Comparison doubt" Watch "Integer Wrappers Comparison doubt" New topic

Integer Wrappers Comparison doubt

Harsha Subbarayappa

Joined: Oct 19, 2010
Posts: 5
Hi Can anyone please explain why it prints

i1 i2 not equal
i3 i4 both equal


Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

try above. by the way : do you know about IntegerCache?

<edit>corrected syntex</edit>
Harsha Subbarayappa

Joined: Oct 19, 2010
Posts: 5
Got it...

Thanks you very much.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Harsha please UseCodeTags when posting code. It will highlight your code and make it much easier to read. It probably will also increase the number of people helping you. I will add them for you this time so that you can see the difference.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I agree. Here's the link:
subject: Integer Wrappers Comparison doubt
It's not a secret anymore!