• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference btn Overriding and Hiding of methods  RSS feed

 
Rajesh Kesarwani
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i have gone through the meaning of 'overriding' and 'hiding'
of Java Methods.
Basically i want to know, what is going on in memory.

Thanks In Advance.

Regards
Rajesh Kumar Kesarwani
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basic difference is that overridden methods are polymorphic, hidden once aren't.

How that works internally depends on the implementation of the JVM. In fact with the Hot Spot engine, it's complicated enough that you could probably write a whole book about it.

Basically you could imagine that the address of a hidden method is hard coded at compile time, but for an overridden method a jump table is used to find the address of the method to use based on the runtime type of an object.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!