Home Help Java S super Java Keyword

Related Tutorials


 
 

Share on Google+Share on Google+

super Java Keyword

Advertisement
The super is a keyword defined in the java programming language.

super Java Keyword

     

The super is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java programming language likewise the super keyword indicates the following : 

-- The super keyword in java programming language refers to the superclass of the class where the super keyword is currently being used.
--  The super keyword as a standalone statement is used to call the constructor of the superclass in the base class.

Example to use the super keyword to call the constructor of the superclass in the base class:

public class Class1{

public Class1(String arg){

super(arg);
}


--  The syntax super.<method_Name>() is used to give a call to a method of the superclass in the base class.
--  This kind of use of the super keyword is only necessary when we need to call a method that is overridden in this base class in order to specify that the method should be called on the superclass.

Example to use the super keyword with a method:

public class Class1{

public String String_Method(){

return super.overriden_String_Method();
}

 

Advertisements

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: June 17, 2009

Related Tutorials

Discuss: super Java Keyword   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:7
lola
December 7, 2011
super

i dont get super: super.feedPlant(int water); the compiler says ".class expected" in front of "water" and I'm confused as to why it won't compile. How do I use super for methods, the site wasn't very clear
GURNAM SINGH
December 8, 2011
java

how to lern java mening to understant; and y java made by useing maths; and symbols system;
SUROJIT GHOSH
January 13, 2012
SUPER

if a is father of b and b is father of c and we USE super in both b & c class we get output FROM a & b class if a is father of both b and c CLASS and we USE super both b & c we get output only 1 time & that must be from class a
Rajesh
April 21, 2012
MCA

theory is good but the example is not enough clear....
smaran
April 23, 2012
sap oops

is it possible to access static methods of superclass to be bass class using SUPER keyword?explain?
dinesh kumar
May 3, 2012
java

m feeling good
shalini kumari
June 12, 2012
super keyword...........

nice concept..........can be easily understood.........
DMCA.com