O'Reilly logo

Core Java™ 2 Volume II - Advanced Features, Seventh Edition by Gary Cornell, Cay S. Horstmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required