Basic HTML version of Foils prepared 17 Nov 97

Foil 25 Methods for Vectors

From Java Tutorial, July 1, 1996 CEWES Tutorial, CPS606, JSU Class CSC499 -- July 22-25 1997, Fall 97. by Nancy J. McCracken,Geoffrey C. Fox, Tom Scavo


Elements are created with the addElement( ... ) method:
Order missouri = new Order();
orders.addElement( missouri );
The object missouri of type Order is automatically converted to an Object and added to Vector instance orders defined on the previous foil.
There are methods for indexing vectors. Like arrays, the indexing is zero-based.
x = (Typeofx) v.elementAt(i);
v.setElementAt( x, i );
The length of the Vector may also be obtained:
int size = v.size;



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998