This example shows the followings
  • Use of Super Key word.
  • Use of Parent or Super Class
  • Passing values to the constructor in the parent or Super Class. 

//PassValue_ParentConstructor.java
public class PassValue_ParentConstructor {
enum Days{Monday, Tuesday};
public static void main(String[] args) {
// TODO Auto-generated method stub
Achild child1 = new Achild();
Bchild child2 = new Bchild();
}
}

// a parent class with a constructor
class Aparent
{
String fname, lname, caller;
public Aparent()
{
System.out.println("AParent default blank constructor ");
}
public Aparent(String fname, String lname)
{
System.out.println("AParent two string constructor " +fname +"\t"+ lname);
}
public Aparent(String fname,String lname, String caller)
{
System.out.println("AParent three string constructor ");
}
}

// an extended child class with a constructor
class Achild extends Aparent
{
public Achild()
{
System.out.println("\tAChild Constructor");
}
}
class Bchild extends Aparent
{
String a="Manas", b="Mukherjee";
public Bchild()
{
super("Smith","Handy");
System.out.println("\tBChild Constructor");
}

}