tuxmartin

static

Oct 1st, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public class A {
  2.     static B classB;
  3.  
  4.     public static void main(String [] args) { // po spusteni vypise "1"
  5.         classB = new B();
  6.         new C();
  7.     }
  8. }
  9.  
  10. public class B {
  11.     public static int b;
  12.    
  13.     B() {
  14.         b = 1;
  15.     }
  16. }
  17.  
  18. public class C {
  19.     C() {
  20.         System.out.println(B.b);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment