Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instanceof

 
ankana mukherjee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this from page no=526(k&B)

in the overriden equals method how can o instanceof Moof be true?
is it because two is instanceof Moof?
[ September 10, 2008: Message edited by: ankana mukherjee ]
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ankana mukherjee:
this from page no=526(k&B)

in the overriden equals method how can o instanceof Moof be true?
is it because two is instanceof Moof?



Right, here temporary object 'o' , holds the reference of object Moof 'two' , thats mean 'two' is instance of "Moof' . Dont get confused with Generic Object instance to that of Moof object , here 'o' is just a reference , which can hold any Valid Java object !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic