Accessing Array Elements

All array types of the Java programming language have corresponding C types, as shown in Table 11-2.

Table 11-2. Correspondence Between Java Array Types and C Types
Java TypeC Type
boolean[]jbooleanArray
byte[]jbyteArray
char[]jcharArray
int[]jintArray
short[]jshortArray
long[]jlongArray
float[]jfloatArray
double[]jdoubleArray
Object[]jobjectArray

The type jarray denotes a generic array.

C++ NOTE

In C, all these array types are actually type synonyms of jobject. In C++, however, they are arranged in the inheritance hierarchy shown in Figure 11-2.

Figure 11-2. Inheritance hierarchy of array types

The GetArrayLength function returns ...

Get Core Java™ 2 Volume II - Advanced Features, Seventh Edition now with O’Reilly online learning.

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