-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.java
More file actions
61 lines (60 loc) · 904 Bytes
/
demo.java
File metadata and controls
61 lines (60 loc) · 904 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
60
61
import java.util.*;
class Person
{
private int id;
private String name;
void setdata(int a, String b)
{
id=a;
name=b;
}
void showdata()
{
System.out.println("Id:"+id+" Name:"+name);
}
};
class Employee extends Person
{
private int salary;
void setsal(int a)
{
salary=a;
}
void showsal()
{
showdata();
System.out.println("Salary:"+salary);
}
};
class Manager extends Employee
{
private String desig;
void setdes(String a)
{
desig=a;
}
void showdes()
{
showsal();
System.out.println("Designation: "+desig);
}
};
class demo
{
public static void main(String args[])
{
Person p=new Person();
p.setdata(101,"Nabeel");
p.showdata();
Employee e=new Employee();
e.setdata(102,"kritika");
e.setsal(25000);
//e.showdata();
e.showsal();
Manager m=new Manager();
m.setdata(103,"ABC");
m.setsal(12000);
m.setdes("Vice President");
m.showdes();
}
};