Advantages of Object cloning in Java

Java 8Object Oriented ProgrammingProgramming

Java keeps references of objects. If two reference are pointing to same object then modification to one reference will reflect in another reference as well. To prevent such situation, cloning is required. In cloning, a copy of object is to be created and used to that both objects can be modified independently. This is one of the major advantage of cloning.

Updated on 30-Jul-2019 22:30:21