Basic HTML version of Foils prepared October 30 1999

Foil 9 Using Array Values

From Short Introduction to Kids on Basic Programming Concepts in Java Sonia Kovalesky festival workshop (High School Girls) -- October 23 1999. by Nancy McCracken


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



© 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 Sat Oct 30 1999