Basic HTML version of Foils prepared Feb 19 1999

Foil 10 Using array values

From Computing and Java Language Basics NPAC Java Academy February--April 99 -- Feb 13 1999. by Nancy McCracken


1 To use an array value, you give the name of the array and the position number within [ ], and use it like any other variable.
2 int numbers [ ] = new int [ 7 ] ;
3 numbers [0] = 5 ;
4 numbers [1] = numbers [0] + 2 ;
5 String labels [ ] = new String [ 64 ];
6 labels [ 0 ] = "The first string label";
7 g.drawString ( labels [ 0 ], 10, 20 ) ;
8 Create the array
9 Assign position 0
10 Use position 0

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 Mon Jul 5 1999