View RSS Feed

Java Array

Class Objects for Arrays

Rate this Entry
by , 03-04-2012 at 11:17 AM (512 Views)
An associated class object is present for every array that is shared to other arrays along with similar component type.An array’s direct superclass is Object. Interfaces java.io.Serializable and Cloneable are implemented by every array type.

Following example code could better explain this:
Java 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
here the string "[I" is the “run-time type” signature, for the class object that is "array with component type int".

Submit "Class Objects for Arrays" to Facebook Submit "Class Objects for Arrays" to Digg Submit "Class Objects for Arrays" to del.icio.us Submit "Class Objects for Arrays" to StumbleUpon Submit "Class Objects for Arrays" to Google

Tags: object array Add / Edit Tags
Categories
Object Array

Comments