Basic HTML version of Foils prepared 9 Sept 1997

Foil 7 Java Language -- Types: Array

From Java to be used in (Scientific) Computing Part II: Java Language and Object-Oriented Concepts Basic Simulation Track for Computational Science CPS615 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox


1 Arrays are "true" or "first class" objects in Java and no pointer arithmetic is supported.
2 An Array is declared as:
  • int vec[];
3 alternative syntax: int[] vec;
4 and created by:
  • vec = new int[128];
5 or concisely:
  • int vec[] = new int[128];
6 Arrays of arbitrary objects can be constructed,
  • e.g. Thread myThreadList[] = new Thread[1024];
  • The only difference is that in the case of primitive types, the array elements are actually allocated. In the case of arbitrary objects, an array of object references is created; before you use array elements, you must call the constructor of that type for each element.

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 Sun Feb 22 1998