Program to Illustrate the use of Methods of Vector Class
import java.util.*;
class vctr
{
public static void main(String arg[])
{
Vector list = new Vector();
int l = arg.length;
for(int i=0; i<l; i++)
{
list.addElement(arg[i]);
}
list.insertElementAt("COBOL",2);
int size = list.size();
String lary[ ] = new String[size];
list.copyInto(lary);
System.out.println("List of Languages");
for(int i=0; i<size; i++)
{
System.out.println(lary[i]);
}
}
}
import java.util.*;
class vctr
{
public static void main(String arg[])
{
Vector list = new Vector();
int l = arg.length;
for(int i=0; i<l; i++)
{
list.addElement(arg[i]);
}
list.insertElementAt("COBOL",2);
int size = list.size();
String lary[ ] = new String[size];
list.copyInto(lary);
System.out.println("List of Languages");
for(int i=0; i<size; i++)
{
System.out.println(lary[i]);
}
}
}
No comments:
Post a Comment