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 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.