-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathep1.java
35 lines (31 loc) · 850 Bytes
/
ep1.java
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
class employee{
int id;
String name;
int salary;
public void printDetails(){
System.out.println("my id is = "+id);
System.out.println("my name is = "+name);
}
public int getSalary(){
return salary;
}
}
public class ep1 {
public static void main(String[] args) {
System.out.println("After creating object = ");
employee emp = new employee();
emp.id = 220904;
emp.name = "its_a_secret.";
//System.out.println(emp.id);
//System.out.println(emp.name);
emp.salary = 19;
emp.printDetails();
employee emp2 = new employee();
emp2.id = 2004;
emp2.salary = 12;
emp2.name = "me nhi btaunga";
emp2.printDetails();
int salary = emp2.getSalary();
System.out.println(salary);
}
}