top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Java: What is clone method and which class contains clone method?

+2 votes
279 views
Java: What is clone method and which class contains clone method?
posted Mar 30, 2016 by Abu Anam

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

clone() is a method in the Java programming language for object duplication. In Java, objects are manipulated through reference variables, and there is no operator for copying an object—the assignment operator duplicates the reference, not the object.

Java supports two type of cloning: - Deep and shallow cloning. By default shallow clone is used in Java. Object class has a method clone() which does shallow cloning.

answer Mar 30, 2016 by Karthick.c
...