static , , .
, .
:
class Test {
static int i;
int j;
}
class Test 2 {
public static void main(String args[]) {
Test test1 = new Test();
Test test2 = new Test();
test1.i = 1;
test1.j = 2;
test2.i = 3;
test2.j = 4;
System.out.println("test1.i: "+test1.i);
System.out.println("test1.j: "+test1.j);
System.out.println("test2.i: "+test2.i);
System.out.println("test2.j: "+test2.j);
}
}
2 Test, "" i.
j.
test1.i: 3
test1.j: 2
test2.i: 3
test2.j: 4
Java -