
a program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = â??Tommyâ?? age=â??23â?? and call this constructor in subclass.

class Superclass{
Superclass(){
}
Superclass(String name,int age){
name="Tommya";
age=23;
System.out.println(name);
System.out.println(age);
}
}
class Subclass extends Superclass{
Subclass(){
super("",0);
}
public static void main(String[]args){
Subclass sub=new Subclass();
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.