Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Help Java S Super - keyword

Related Tutorials


Share on Google+Share on Google+

Super - keyword

super is a keyword in java that plays an important role in case of inheritance.

Super - keyword


super keyword

super is a keyword in java that plays an important role in case of inheritance. Super keyword is used to access the members of the super class. Java uses this keyword to resolve two purposes.

The first purpose is, accessing the hidden data variables of the parent class hidden by the child class.

Lets take an example, Suppose there is a class A that includes two instance variables as  int a and float b. class B extends to class A and contain its own data members having the same name a and b. In this case variables of class B hides the variables of class A, to access to those variables we the super keyword. Accessing of super class variables is done by using the following syntax.


Here member can refer to either an instance variable or a method.

Calling super class constructor: Super keyword is also used to call super class constructor in the subclass. This is done by using the following command.


Here parameter list includes the parameter that the constructor requires in the super class. super is always be be the first statement to be executed inside a super class constructor. Pass the empty parameter list in order to call the default constructor.

To know more about super click at: 


If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 17, 2009

Related Tutorials

Discuss: Super - keyword   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image