Advertisement
wandrake

Untitled

Jul 16th, 2013
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. class A extends Object {
  2.     public int x;
  3.     private C y = new C();
  4.     public A (C u) {
  5.         x = this.y.x + 2;
  6.         y = u;
  7.     }
  8.     public int add(int u) {
  9.         this.x = 2*this.x+u;
  10.     }
  11. }
  12.  
  13. class B extends A {
  14.     public int x = 0;
  15.     public B (C u) {
  16.         super(u);
  17.     }
  18.     public B () {
  19.         this.x = 10;
  20.     }
  21.     public int add(int u) {
  22.         this.x = u;
  23.     }
  24. }
  25.  
  26. class C extends Object {
  27.     public int x = 7;
  28.     C () {}
  29. }
  30.  
  31. A z = new B(new C())
  32. int w = z.x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement