waltermilner

Untitled

Jan 22nd, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1.  
  2. class InterClass {
  3.  
  4.   int x = 4;
  5.  
  6. }
  7.  
  8. interface MyInterface {
  9.  
  10.   public static final InterClass inter = new InterClass();
  11. }
  12.  
  13. public class Test implements MyInterface {
  14.  
  15.   public static void main(String[] args) {
  16.     Test t1 = new Test();
  17.     t1.inter.x = 9;
  18.     Test t2 = new Test();
  19.     t2.inter.x = 7;
  20.     System.out.println(t1.inter.x); //7
  21.  
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment