Vector in Java - Sample Program

By: Paawan Chaudhary Printer Friendly Format    

This java program implements a Vector that accepts five items from the command line and store them in a Vector and display the objects stored in a Vector.

import java.lang.*;
import java.util.*;
class q8Vector
	public static void main(String args[])
		Vector list = new Vector();
		int len=args.length;
		for(int i=0;i<len;i++)
		int size=list.size();
		String str[]= new String[size];
		for(int i=0;i<size;i++)
			System.out.println ("Element of Vector at position "+i+":"+str[i]);

Most Viewed Articles (in Java )

Latest Articles (in Java)

Comment on this tutorial

Subscribe to Tutorials

Related Tutorials

Archived Comments

1. can you non grab the data direct from the vector w
View Tutorial          By: paul at 2013-08-30 11:22:04

2. hello,
how can i add a specific variable va

View Tutorial          By: Abdulla at 2014-12-05 15:30:27

3. hi!
how can i add variable form object to a

View Tutorial          By: rushi at 2015-07-16 08:18:58

4. how this program is work , please, tell
View Tutorial          By: rohit kumar at 2015-10-30 12:22:05

5. can you please help me with the code for storing t
View Tutorial          By: roja at 2016-02-04 08:03:49

6. Major thanks for the blog post. Really Great.
View Tutorial          By: Latest Happy Holi Wishes at 2016-02-12 10:10:53

7. I truly appreciate this blog post.Really looking f
View Tutorial          By: CBSE 10th Result at 2016-02-12 10:30:52

8. It's a shawme you don't have a donate button! I'd
View Tutorial          By: Barcelona Strip club at 2017-03-04 09:33:31