HELP! * GREY=local LOCAL HTML version of Foils prepared January 8,96

Foil 31 Java Language -- Types: Array

From Overview of Java SC95 Tutorial on Web Technologies -- December 4,95. by NPAC Team * See also color IMAGE

An Array is declared as:
  • int vec[];
and created by:
  • vec = new int[128];
or concisely:
  • int vec[] = new int[128];
Subscripts are range checked in runtime and so vec[-1] and vec[128] will generate exceptions.
Array length can be extracted via the length instance variable, e.g.
  • int len = vec.length will assign len = 128.
Arrays of arbitrary objects can be constructed,
  • e.g. Thread myThreadList[] = new Thread[1024];



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 Tue Feb 18 1997