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


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

in Table To:


© 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