File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes question about adding to a vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "question about adding to a vector" Watch "question about adding to a vector" New topic

question about adding to a vector

jon ladd
Ranch Hand

Joined: Feb 11, 2003
Posts: 53
I want to read in the employee name that is enter from the user and store it to a vector. I have tired it and its under the employee case. All the examples are with data that is already put in to a vector.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
You should familiarize yourself with the Java API documentation. You can easily look up the answers to such questions. For example, if you look at the docs for the Vector class, you will see that you an use the add() method (Sorry, the board wouldn't let me link directly to the method since the URL has parenteses in it. You can just scroll down the page above to find it.) to append elements into a Vector. It takes a single argument which is the Object you wish to add. For example:

The Objects can also be reference variables:

You should be able to adapt these examples to fit your particular situation.
[ April 29, 2003: Message edited by: Layne Lund ]

Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: question about adding to a vector
It's not a secret anymore!