class Kloon2 implements Cloneable{ String nimi; Kloon2 isa; Kloon2 ema; public Object clone(){ Object o=null; try{ o=super.clone(); Kloon2 k=(Kloon2)o; if(isa!=null){ k.isa=(Kloon2)isa.clone(); } if(ema!=null){ k.ema=(Kloon2)ema.clone(); } }catch(CloneNotSupportedException e){} return o; } public String toString(){ String s=nimi+"("; if(isa!=null){ s+=isa.toString(); } s+=", "; if(ema!=null){ s+=ema.toString(); } s+=")"; return s; } }