关于java中数组也是对象的强悍解释

Object[]objs = new Object[ 3 ];
Objectobj
= objs;
objs
= (Object[])obj;

另外,下文对java中的数组的本质做了一些探讨:
http://dev.csdn.net/author/DeepNightTwo/afb7e220bdf5423ba656f84b6a183b44.html

另,
/**/ /*
*TestObjectArray.java,2007-6-1617:07:29.
*
*CopyRight(c)2007-2007,yethyeth,Allrightsreserved.
*
*ThisfileislicencedundertheApacheLicense.
*
*
*thisfileshowsthatobjectarraysistreatedasobjects.
*/

package cn.yethyeth.sample;

public class TestObjectArray ... {

/***//**
*
@paramargs
*/

publicstaticvoidmain(String[]args)...{
//TODOAuto-generatedmethodstub
Object[]objs=newObject[2];
objs[
0]=newInteger(0);
objs[
1]=newInteger(1);
Objectobj
=(Object)objs;
Object[]objs2
=(Object[])obj;
System.out.println(objs2[
1]);

int[]is=newint[2];
is[
0]=0;
is[
1]=1;

Objectobj1
=(Object)is;
System.out.println(obj1);
System.out.println(obj1.getClass());
int[]iss=(int[])obj1;
System.out.println(iss[
1]);
}


}


结果:
1
[I@148cc8c
class [I
1

你可能感兴趣的:(java)