Professional Documents
Culture Documents
Session 1
Session 1
ADVANCED OOP
21CS2116RA
Topic:
INHERITANCE
Session - 1
INSTRUCTIONAL OBJECTIVES
LEARNING OUTCOMES
class Employee{
float salary=40000;
}
class Programmer extends Employee{
int bonus=10000;
public static void main(String args[]){
Programmer p=new Programmer();
System.out.println("Programmer salary is:"+p.salary);
System.out.println("Bonus of Programmer is:"+p.bonus);
}
}
Output:
Programmer salary is:40000.0Bonus of programmer is:10000
•Develop Animal, Monkey and Human classes in the hierarchy with three
level multilevel inheritance. Write atleast one method in each class and
Methods of the Monkey class must be overridden in Human class.
Declare objects fro all three classes, all respective methods, write outputs?
Reference Books:
1. Java for beginners
2. Complete reference Java
3. Mastering java