forked from tracksdata/fdcs-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.java
More file actions
50 lines (36 loc) · 1.02 KB
/
Employee.java
File metadata and controls
50 lines (36 loc) · 1.02 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
class Employee{
int empId; // instance
static String companyName; // static
void m1(){ // non static method
empId=1000;
companyName="Cognizant Technologies";
Test t=new Test();
t.x=999;
}
static void m2(){ // static
//empId=2000; // invalid
Employee obj=new Employee();
obj.empId=100000;
companyName="Bla Bla";
Test t=new Test();
t.x=777;
}
public static void main(String args[]){
m2();
Employee e1=new Employee();
Employee e2=new Employee();
Employee e3=new Employee();
e1.empId=10;
e2.empId=20;
e3.empId=30;
e1.m1();
// companyName="Cognizant";
//companyName="CTS";
System.out.println("Company Name: "+companyName);
System.out.println("E1: "+e1.empId);
System.out.println("E2: "+e2.empId);
System.out.println("E3: "+e3.empId);
System.out.println("------------------");
System.out.println("Y: "+Test.y);
}
}