1 public class ValueSubclass extends Value { 2 public Value tmp; 3 4 /** 5 * Test of subclass initialisation with super usage and foreign object initialisation. 6 */ 7 public ValueSubclass(int x) { 8 super(x); 9 tmp = new Value(42); 10 } 11 12 /** 13 * Test of overriding. 14 */ 15 public void setValue(int x) { 16 this.value = -x; 17 } 18 19 /** 20 * Test of overriding and super methods. 21 */ 22 public int add(int x) { 23 return super.add(-x); 24 } 25 26 /** 27 * Test of objects as arguments. 28 */ 29 public void setValueObject(Value v) { 30 this.value = v.getValue(); 31 } 32 }