• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deepak's mock exam simulator

 
Shweta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the options in the qs.
"which of the foll is true"
says (this is the answer given)
"equals() provide deep comparison and == provides shallow comparison"
But,actually equals() & == provide the same comparison unless overridden to do otherwise or in case of boolean & string .
kindly show me the light if wrong...
regds,
shwe
[This message has been edited by Shweta (edited October 29, 2000).]
 
Eric Boehme
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the RHE book, they refer == as a shallow comparison, because it just does a memory address comparison, whereas equals() is an overidden method in a class extended from Object (the source of the equals() method), and thus does a deeper level comparison.
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shweta,
We have a naming policy here at the Ranch and your name is not a valid user name. Could you pleae re-register with a more appropriate name. Check here for more infor http://www.javaranch.com/names.jsp
Thanks for your posts,
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic