clone() method in Java

前端 未结 5 996
再見小時候
再見小時候 2021-02-14 22:14

as I understood, the method clone() gives us the ability to copy object (no refernce) in Java. But I also read, that the copy is shallow. So what the point? Which a

5条回答
  •  执笔经年
    2021-02-14 22:59

    Shallow copy is the default for Object. you can override clone to do a deep copy.

提交回复
热议问题