| CHAPTER 10: Arrays |
Previous |
Java Language |
Index |
Next |
Every array has an associated Class object, shared with all other arrays with the same component type. The superclass of an array type is considered to be Object , as shown by the following example code:
class Test {
public static void main(String[] args) {
int[] ia = new int[3];
System.out.println(ia.getClass());
System.out.println(ia.getClass().getSuperclass());
}
}
which prints:
class [I class java.lang.Object
where the string "[I
" is the run-time type signature for the class object "array with component type int
" (S20.1.1).
| © 1996 Sun Microsystems, Inc. All rights reserved. |