Java super Keyword Syntax With Example

here simple you learn to Keywords of java, Super is a one type of the reference (superclass (parent) objects.) variable that is used to references parent class of main object. Also i learn into my prev Best Articles on this keyword, final keyword, static keyword in java.

Use of Core Java super keyword

Simple Definition: Super() is used to invoke parent class constructor, method or variable.

Syntax

super.your-custom-method-name();

Also Read: How to convert a String to Char Array in Java?

super keyword in java

lass Katmoviehd{
	String jiorockers="bolly4u";
}
class Khatrimaza extends Katmoviehd{
		String jiorockers="jalshamoviez";
		void printJiorockers(){
		System.out.println(jiorockers);
		System.out.println(super.jiorockers);
	}
}
class Okhatrimaza{
	public static void main(String args[]){
		Khatrimaza c=new Khatrimaza();
		c.printJiorockers();
	}
}

Results :

bolly4u
jalshamoviez

Also Read: Paypal Payment Gateway Integration using Java

Leave a Comment