Open In App

ArrayList clone() method in Java with Examples

Last Updated : 18 Dec, 2018
Comments
Improve
Suggest changes
6 Likes
Like
Report
The Java.util.ArrayList.clone() method is used to create a shallow copy of the mentioned array list. It just creates a copy of the list. Syntax:
ArrayList.clone()
Parameters: This method does not take any parameters. Return Value: This function returns a copy of the instance of Linked list. Below program illustrate the Java.util.ArrayList.clone() method: Example 1:
Output:
First ArrayList: [Geeks, for, Geeks, 10, 20]
Second ArrayList is: [Geeks, for, Geeks, 10, 20]
Example 2:
Output:
First ArrayList: [10, 20, 30, 40, 50]
Second ArrayList is: [10, 20, 30, 40, 50]

Next Article
Article Tags :
Practice Tags :

Similar Reads