3:42 pm - Saturday November 17, 6260

Vector Example Program for clone()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/*vector example program for clone()*/
/**
*@Author:CandidJava.com
*@Description:clone the elements in vector class
*/

import java.util.Vector;
import java.util.Enumeration;

public class Clone
{
public static void main(String args[])
{
Vector vc=new Vector();
vc.add("aaa");
vc.add("bbb");
Enumeration E=vc.elements();//create enumeration interface
System.out.println("elements in vector");
while(E.hasMoreElements())
{
System.out.println(E.nextElement());
}
Object ob=vc.clone();//clone the elements
System.out.println("clone of the vector is:"+ob);
}
}

OUTPUT:
elements in vector
aaa
bbb
clone of the vector is:[aaa,bbb]

Filed in: Z-A All Java Codes

Comments are closed.