-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOOPS1.java
More file actions
42 lines (31 loc) · 754 Bytes
/
OOPS1.java
File metadata and controls
42 lines (31 loc) · 754 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
class Employee{
int id;
String name;
int salary;
public void printdetails() {
System.out.println("My id is "+id);
System.out.println("My id is "+name);
}
public int getSalary() {
return salary;
}
}
public class OOPS1 {
public static void main(String[] args) {
System.out.println("This is our custom class");
Employee harry= new Employee();
Employee Arpit= new Employee();
harry.id=12;
harry.name="Code with harry";
harry.salary=100;
//System.out.println(sc.id);
//System.out.println(sc.name);
Arpit.id=17;
Arpit.name="AKJ";
Arpit.salary=10000;
harry.printdetails();
Arpit.printdetails();
int m=Arpit.getSalary();
System.out.println(m);
}
}