Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Makes people Fool by == and equals()

 
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic