-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee_protect.java
More file actions
54 lines (50 loc) · 1.07 KB
/
Employee_protect.java
File metadata and controls
54 lines (50 loc) · 1.07 KB
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
import java.util.*;
class Employee{
private String name ="Ram";
private int empid = 123;
private int salary = 50000;
protected int salary2 =45000;
public void setname(String name){
this.name=name;
}
public String getname(){
return name;
}
public void setempid(int empid){
this.empid = empid;
}
public int getempid(){
return empid;
}
public void setsalary(int salary){
this.salary = salary;
}
public int getsalary(){
return salary;
}
public void setsalary2(int salary2){
this.salary2=salary2;
}
public int getsalary2(){
return salary2;
}
public void display(){
System.out.println(name);
System.out.println(empid);
System.out.println(salary);
System.out.println(salary2);
}
}
class company extends Employee{
public void details(){
System.out.println(salary2);
super.display();
}
}
public class Main{
public static void main(String [] args){
Employee emp = new Employee();
company c = new company();
c.details();
}
}