• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

== and != for Wrapper Objects

 
Mohnish Khiani
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What and how is this happening?


Output :
i1!=i2
i3==i4
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Autoboxing uses a cache of values between -128 and 127. If you SearchFirst you will find many threads about the same question.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Such as this one.
 
Mohnish Khiani
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it...thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic