Basic HTML version of Foils prepared Feb 19 1999

Foil 9 Arrays

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


1 Sometimes you have a collection of values that you want to give one name. One way to do that in Java is to have an array.
2 To create an array like this, you must say what type the elements are (they must all be the same type) and how many there will be:
3 An array has a set of positions to store values. Each position is given an index number:
4 int numbers [ ] = new int [ 7 ] ;
5 String labels [ ] = new String [ 64 ] ;
6 0 1 2 3 4 5 6

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