-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo4.java
More file actions
59 lines (59 loc) · 997 Bytes
/
demo4.java
File metadata and controls
59 lines (59 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import java.util.*;
class Person
{
private int id;
private String name;
Person(int a, String b)
{
this.id=a;
this.name=b;
}
void showdata()
{
System.out.print("Id:"+id+" Name:"+name);
}
};
final class Employee extends Person
{
final private int salary=0;
Employee()
Employee(int a,String b,int c)
{
super(a,b);
salary=c;
}
final void showdata()
{
super.showdata set();
System.out.print(" Salary:"+salary);
}
};
class Manager extends Employee
{
private String desig;
Manager(int a,String b,int c,String d)
{
super(a,b,c);
desig=d;
}
void showdata()
{
super.showdata();
System.out.print(" Designation:"+desig);
}
};
class demo4
{
public static void main(String args[])
{
Person p=new Person(101,"Nabeel");
p.showdata();
System.out.println('\n');
Employee e=new Employee(102,"kritika",25000);
e.showdata();
System.out.println('\n');
Manager m=new Manager(103,"ABC",12000,"Vice President");
m.showdata();
System.out.println('\n');
}
};