Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Use of vector class

This is a discussion on Use of vector class within the Java forums, part of the Software Development category; plz tell me the use of vector & how is diff from array...

Go Back   Geeks Talk > Software Development > Java
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Java Java related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-29-2008
Junior Member
 
Join Date: Dec 2008
Location: delhi
Posts: 8
Thanks: 3
Thanked 1 Time in 1 Post
soniyaparjapat is on a distinguished road
Unhappy Use of vector class

plz
tell me the use of vector
& how is diff from array
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-31-2008
Junior Member
 
Join Date: Dec 2008
Location: hyderabad
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
sancooljit is on a distinguished road
Re: Use of vector class

define a variable of type Vector, and call the vector constructor.

Vector myVector = new Vector ();

OR
myVector = new Vector(50);

dynamically increase the size of the vector, bt in case of array the size is fixed.

2] Implement the Enumeration interface which makes traversing the contents of a Vector extremely easy.
ex
for (Enumeration e = myVector.elements(); e.hasMoreElements()
{
String myString = (String) e.nextElement();
System.out.println(myString);
}
3] Arrays in Java are static lists declared to store a certain number of a certain kind of variables.
Vector in java are lists declared to store any number of nay kind of variables.
Reply With Quote
  #3 (permalink)  
Old 01-05-2009
Junior Member
 
Join Date: May 2007
Location: Coimbatore
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Akilan Paul is on a distinguished road
Re: Use of vector class

vector is a synchronized data structure
array is unsynchronized data structure
main difference is synchronized data structure performance is low compare with unsynchronized one.
when ever you feel a block of code is accessed by morethan one thread that time you go for synchronized data structures (i.e is thread safe)
Reply With Quote
Reply

  Geeks Talk > Software Development > Java

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
An ArrayList and a Vector FantaGuy Java 5 03-19-2009 12:34 PM
what is the use of Beaninfo class and introspector class in java beans? anveth Java 0 11-24-2008 01:36 AM
Vector data should be placed in Drop Down box upenderreddy JSP 1 07-31-2007 07:17 AM
Why we say arraylist is not synchronized where as vector are Geek_Guest Java 1 06-20-2007 12:50 PM
Web Service method returns a vector of objects ssumitha ASP.NET 1 12-14-2006 08:25 AM


All times are GMT -4. The time now is 03:55 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved