Tuesday, July 20, 2021

simple program check where we use the super keyword (Java) (211)

package com.company;
class parenth
{
public parenth()
{
System.out.println("i am a constructor of grand father class.");
}
public parenth(int a)
{
System.out.println("i am overloaded constructor of a grand father class : " +a);
}
}
class child extends parenth
{

public child()
{
super(0);
System.out.println("i ma a constructor of a father class.");
}
public child(int b)
{

System.out.println("i am overloaded constructor of a father class: ");
}
}
public class Program48 {
child o=new child();


}

No comments:

Post a Comment