Write a Java program to implement a vector that accepts five elements from the command line and store them in vector and display the objects stored in a vector

import java.util.*;
class Exp5_1
{
 public static void main(String[] args) 
 {
  Vector v = new Vector();
  for(int i=0;i<5;i++)
   v.addElement(args[i]);
  Enumeration vEnum = v.elements();
  System.out.println("Elements in Vector are: ");
  while(vEnum.hasMoreElements())
   System.out.print(vEnum.nextElement() + " ");
 }
}
/*  OUTPUT!!!
javac Exp5_1.java
java Exp5_1 Java OS SP CS SE
Elements in Vector are:
Java OS SP CS SE
*/
Copyright © LetML. Blogger Templates Designed by OddThemes