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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.