aspose file tools*
The moose likes Beginning Java and the fly likes == and != for Wrapper Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "== and != for Wrapper Objects" Watch "== and != for Wrapper Objects" New topic
Author

== and != for Wrapper Objects

Mohnish Khiani
Ranch Hand

Joined: May 17, 2010
Posts: 65
What and how is this happening?


Output :
i1!=i2
i3==i4
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Autoboxing uses a cache of values between -128 and 127. If you SearchFirst you will find many threads about the same question.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Such as this one.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Mohnish Khiani
Ranch Hand

Joined: May 17, 2010
Posts: 65
got it...thank you
 
Don't get me started about those stupid light bulbs.
 
subject: == and != for Wrapper Objects