File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between redefining and overridding

 
srilavanyaa subramanian
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic