class Person
{
String name;
int age;
void getdata(String a,int b)
{
name=a; age=b;
}
}
class Teacher extends Person
{
String qualification;
float salary;
void getqual(String s)
{
qualification =s;
}
void getsal(float a)
{
salary=a;
}
void display()
{
System.out.println("\nName of Faculty = "+name);
System.out.println("\nAge of Faculty = "+age);
System.out.println("\nQualification of Faculty = "+qualification);
System.out.println("\nSalary of Faculty = "+salary);
}
}
class guestTeacher extends Teacher
{
float ppl;
void getppl(float a)
{
ppl=a;
}
void display( )
{
System.out.println("\nName of Guest Lecturer = "+name);
System.out.println("\nAge of Guest Lecturere = "+age);
System.out.println("\nQualification of Guest Lecturer = "+qualification);
System.out.println("\nPayment per Lecture = "+ppl);
}
}
class multiple1
{
public static void main(String args[ ])
{
Teacher teach=new Teacher( );
teach.getdata("S.Senthilvelan",40);
teach.getqual("MCA.,M.E.,");
teach.getsal(45000);
teach.display( );
guestTeacher gteach=new guestTeacher( );
gteach.getdata("M.Sasikumar",42);
gteach.getqual("MCA.,M.E.,Ph.D.,");
gteach.getppl(2000);
gteach.display( );
}
}Java
Java - Multilevel Inheritance

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
