Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are the rules for using 'super' keyword ?

 
ashwin bhawsar
Ranch Hand
Posts: 62
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the rules/restructions/scenarios for how & where we can and cannot use the 'super' keyword.
 
shaileshkumar mistry
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

can
super.<method_Name>() is used to call a method of super class.
super keyword can be use to call the constructor of the superclass in the base class.


can't
super keyword can not be used inside static methods.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic