Develop a program that creates a vector to insert
and display five elements of different data types
Program:
Program:
import java.util.*;
class VectorDemo
{
public
static void main(String args[])
{
Vector
v = new Vector();
v.addElement(new
Integer(10));
v.addElement(new
Float(1.2));
v.addElement(new
Double(5.2));
v.addElement(new
Character('A'));
v.addElement(new
String("Ashish"));
int
s = v.size();
for(int
i=0;i<s;i++)
System.out.println(v.elementAt(i));
}
}
Output:
No comments:
Post a Comment