Chapter 13. Arrays

If you have done any scientific or engineering programming you are familiar with using arrays. In Java, as in every other programming language, arrays are used for storing data. If you solve a system of equations or create a computational grid you will be using arrays. Since Java is a C-based language, there are some similarities between Java and C arrays. Java array indices start at 0. An element of a Java array can be accessed using the element index surrounded by brackets, [].

There are some notable differences between Java and C arrays. Java arrays are objects. Memory for an array is allocated on the heap using the new keyword. Arrays implicitly extend from the Object class and can use Object class methods. Unlike other languages, ...

Get Technical Java™: Developing Scientific and Engineering Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.