• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Doubt in Boxin equals() and ==

 
Ranch Hand
Posts: 41
Mac OS X Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Doubt on behavior of !=, == and equals method in following example from K&B. please some one explain little bit more about that. sorry for such stupid question.


Thanks In Advance.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jeetendra Choudhary wrote:I have Doubt on behavior of !=, == and equals method in following example from K&B. please some one explain little bit more about that. sorry for such stupid question.


Thanks In Advance.



The output is:
Different Object
Meaningfuly Equal
Same object
Meaningfuly Equal

I am just a human compilator

If we perform == on Integer, Short and Byte wrapper objects whose boxing value is from interval (-128; 127), the operator returns true. Very important is that those values must be AUTOboxed. If we would create them using operator new, we were given false by ==. new always allocates new space in memory.

This question was answered a couple of times, so read the forum carefully, please

 
jeetendra Choudhary
Ranch Hand
Posts: 41
Mac OS X Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also suggest me practice questions objective wise so i can solve to revise the previous objectives learned. Have played the rules roundup game lots of time it helped me very very much and thanks alot for that. but it still lacks questions for 1.6. please suggest me objective wise questions.
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic