class Person { String name ; int age ; Person() { System.out.println( "Person()" ) ; } } class Employee extends Person { String jobTitle ; String DeptName ; String ssn ; Employee() { System.out.println( "Employee()" ) ; } } class Person1 { String name ; int age ; Person1() { System.out.println( "Person1()" ) ; } Person1( String nameP , int ageP ) { name = nameP ; age = ageP ; System.out.println( "Person1() with arguments" ) ; } void print() { System.out.println("name: " + name + " age: " + age ) ; } } class Employee1 extends Person1 { String jobTitle ; String DeptName ; String ssn ; Employee1( String nameP, int ageP, String jobTitleP, String DeptNameP, String ssnP ) { //super() //If we don't supply super then the default super // ( without any args constructor ) if // it exists will be called for us //jobTitleP, DeptNameP, ssnP super( nameP , ageP ) ; jobTitle = jobTitleP ; DeptName = DeptNameP ; ssn = ssnP ; System.out.println( "Employee1 with arguments()" ) ; } void print() { //Calling a base class method from derived class //if it has the same method name super.print() ; System.out.println("Job Title: " + jobTitle + " Dept: " + DeptName + " ssn:" + ssn ) ; } } public class Inheritance1 { public static void main( String args[] ) { Employee employeeObject = new Employee() ; System.out.println( "--------" ) ; Employee1 employeeObject1 = new Employee1("Joe Bugner", 35 , "Programmer", "Engineering" , "119701024" ) ; employeeObject1.print() ; } //public static void main( String args[] ) }