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