tmpc is a static variable so there is only one copy for all objects
of the c class. Your method_1 and method_2 create 2 objects of
the b class, but each holds a reference to the same object of the
c class. After creating the b objects, try testing to see if they
have
the same tmpc object:
public class StaticTest {
public static void main(String [] args) {
b tmp1 = new b();
b tmp2 = new b();
if(tmp1.tmpc == tmp2.tmpc)
System.out.println("Only one c object");
}
}
to see if they are the same object. (Using == will only evaluate
true if the reference variables point to the same object). It prints
that line of course.