Mandatory cloneable interface in Java

后端 未结 6 1602
北恋
北恋 2021-01-06 09:01

I\'m having a small problem in Java. I have an interface called Modifiable. Objects implementing this interface are Modifiable.

I also have a ModifyCommand class (wi

6条回答
  •  不思量自难忘°
    2021-01-06 09:49

    Did you define the signature exactly as it is in object?

    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
    

    This should compile - add custom code to the body. Wikipedia was surprisingly helpful on this one.

提交回复
热议问题