aspose file tools*
The moose likes Beginning Java and the fly likes Vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Vectors" Watch "Vectors" New topic
Author

Vectors

Salue Lek
Greenhorn

Joined: Jul 13, 2001
Posts: 4
Can somebody point me to where I can learn more about vectors and how to go about filling them?
thanks,
Salue
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Moved to Java in General - no Vectors in these assignments


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Art Metzer
Ranch Hand

Joined: Oct 31, 2000
Posts: 241
Well, there's the Java's API for java.util.Vector.
To fill a vector, you'll want to use java.util.Vector's add() method. To retrieve the nth element of a vector, you'll want to use the elementAt() method, which returns a java.lang.Object, so if you use elementAt(), you'll probably have to cast to what you need.
Here's a program I created for another JavaRancher some time back; it shows how to fill and retrieve elements from a vector:

This example may be overkill for your question, but it shows the use of a vector in action.
Good luck,
Art
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vectors