clone时,做一下转换就行了,不过你的算法好像有问题
if( this.next != null )
((Snake)o).next=(Snake)this.next.clone( );
结果
after s.increment,
s = :b:c:d:e:f
s2 = :a:b:c:d:e
if( this.next != null )
((Snake)o).next=(Snake)this.next.clone( );
结果
after s.increment,
s = :b:c:d:e:f
s2 = :a:b:c:d:e
这里可能引起循环递归。