-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTut15.java
More file actions
40 lines (31 loc) · 708 Bytes
/
Tut15.java
File metadata and controls
40 lines (31 loc) · 708 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
package tutorial;
//Getter and Setter
class Employee2 {
public int id;
public String name;
// Auto generated from Eclipse ide
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 class Tut15 {
public static void main(String[] args) {
// creating the object of class Employee
Employee2 em = new Employee2();
em.setId(123);
em.setName("Prathamesh");
System.out.println("ID : " + em.getId() + "\nName : " + em.getName());
em.setId(124);
em.setName("Sushant");
System.out.println("ID : " + em.getId() + "\nName : " + em.getName());
}
}