Emp 要实现Cloneable标识接口就行class  Emp  implements Cloneable{
}还要保证Emp的内部属性也是实现了Cloneable接口的。

解决方案 »

  1.   

    这个我知道,书上接下来就是这么写的?
    我想问的就是为什么e1.clone()方法在ClontTest类中不可见?
      

  2.   

    我看啦java的源代码
    * @return     a clone of this instance.
         * @exception  CloneNotSupportedException  if the object's class does not
         *               support the <code>Cloneable</code> interface. Subclasses
         *               that override the <code>clone</code> method can also
         *               throw this exception to indicate that an instance cannot
         *               be cloned.
         * @see java.lang.Cloneable
         */
        protected native Object clone() throws CloneNotSupportedException;
    也就是说必须是继承啦Cloneable接口才可以用clone() 因为实现是native 所以与所说的
    protected 关系...........
      

  3.   

    native什么意思??为什么我们的书上没有??。