-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExample4.java
More file actions
43 lines (42 loc) · 774 Bytes
/
Example4.java
File metadata and controls
43 lines (42 loc) · 774 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
package Encapsulation;
class Employee
{
private int id;
private String name;
private int salary;
public int getID()
{
return id;
}
public void setID(int id)
{
this.id = id;
}
public String getNAME()
{
return name;
}
public void setNAME(String name)
{
this.name = name;
}
public int getSALARY()
{
return salary;
}
public void setSALARY(int salary)
{
this.salary= salary;
}
}
public class Example4
{
public static void main(String[]args)
{
Employee E = new Employee();
E.setID(101);
E.setNAME("Raj");
E.setSALARY(25000);
System.out.println(E.getID()+" "+E.getNAME()+" "+E.getSALARY());
}
}