super() is added in each class constructor automatically by compiler if there is no super()

Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)

903

Program:

 class Parent{
	Parent(){
		System.out.println("I am Parent class");
		}
}

class Child extends Parent{
	Child(){
	System.out.println("I am Child class");
	}
}

class SuperKeyword {
	public static void main(String args[]){
	Child obj=new Child();
	}
}

/* The super keyword can also be used to invoke the parent class constructor.

super() is added in each class constructor automatically by
compiler if there is no super() or this().

*/

Output:

I am Parent class
I am Child class
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.