• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Makes people Fool by == and equals()  RSS feed

 
Hussain
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Salam(Hi) all,
hope every budy fine and doing well in java .Do any budy think tht java makes people fool by == and equals( ) as they do same work in object class and the Scjp2 exam have need to have a test on tht ?

------------------
Muhammad Hussain
 
Fei Ng
Ranch Hand
Posts: 1245
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Muhammad Hussain:
Salam(Hi) all,
hope every budy fine and doing well in java .Do any budy think tht java makes people fool by == and equals( ) as they do same work in object class and the Scjp2 exam have need to have a test on tht ?


What do you mean by same work?
If you mean the Object class's equals method with ==. Yea, it is.
But some Object overridden it, like String object. They actually compare the actually value of the Object not the reference.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!