Java Vector clone() MethodThe clone() method of Java Vector class is used to get a clone of the vector which is in use. Syntax:Following is the declaration of clone() method: Parameter:This method does not accept any parameter. Returns:This method returns a clone of the vector which is in use. Exceptions:NA Compatibility Version:Java 1.2 and above Example 1:Test it NowOutput: Original vector: [Tiger, Deer, Dog, Camel] Cloned vector: [Tiger, Deer, Dog, Camel] Example 2:Test it NowOutput: Elements in vector are: Number = 4 Number = 3 Number = 2 Number = 1 Elements in vecclone vector are: Number = 4 Number = 3 Number = 2 Number = 1
Next TopicJava Vector
|