aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes difference between redefining and overridding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "difference between redefining and overridding" Watch "difference between redefining and overridding" New topic
Author

difference between redefining and overridding

srilavanyaa subramanian
Greenhorn

Joined: May 30, 2006
Posts: 26
hi guys can any one give me an example of an method redefining and overridiing a method.I have read that static variable can be redefiend could not be override.the example they have given seems to be override so pls explain me any one
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2341
Consider this example.



The output is



Notice that print() is a class method, and printName() is an instance method.

When you call the method print() with a Test11 reference to a Test10 object, it calls the static method print() in Test11.

When you call the method printName() with a Test11 reference to a Test10 object, it calls the overridden printName() method in Test10.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: difference between redefining and overridding
 
Similar Threads
Static method modifier question
static methods
what is the difference b/w overriding and redifining
Name Hiding
difference between redefining and overriding