1 4 package com.tctest.transparency; 5 6 public class SubClassC extends SubClassB { 7 8 int j = 9; 9 10 public synchronized void method1() { 11 i = 20; 12 super.method1(); 13 } 14 15 public SubClassB getCopy() { 16 return super.getCopy(); 17 } 18 19 public Object clone() { 20 try { 21 SubClassC c = (SubClassC) super.clone(); 23 c.i++; 24 c.j--; 25 return c; 26 } catch (CloneNotSupportedException e) { 27 throw new RuntimeException (e); 28 } 29 } 30 31 public synchronized void checkedUnCheckedSetsAndGets() { 32 int newj = j + 100; 34 int newi = i + 1000; 35 j = newj; 36 i = newi; 37 38 SubClassD d = new SubClassD(); 40 d.d = d.d ++; 41 } 42 43 public String toString() { 44 return "SubClassC::" + super.toString(); 45 } 46 47 public boolean equals(Object o) { 48 if (this == o) return true; 49 if (o instanceof SubClassC) { return j == ((SubClassC)o).j && super.equals(o); } 50 return false; 51 } 52 } 53 | Popular Tags |