你可以把基本上所有的实例化出来的东东看成是对象,也包括数组
可以是String[] a
同样也可以做个jLabel[] b

解决方案 »

  1.   

    数组当然有实例字段 , length就是一个
      

  2.   

    数组是对象呀,继承了Object了所有方法呀
      

  3.   

    是对象
    继承了Object的方法
      

  4.   

    数组对象只有一个public final int length域,没有提供除了继承自Object以外的方法,构造方法应该是两个参数,第一个是数组的类型(也就是Class类型的参数),第二个是数组的长度(int)
      

  5.   


    package java.lang.reflect;
    public final
    class Array {      private Array() {}
            public static Object newInstance(Class componentType, int length)
    throws NegativeArraySizeException {
    return newArray(componentType, length);
        }      public static Object newInstance(Class componentType, int[] dimensions)
    throws IllegalArgumentException, NegativeArraySizeException {
    return multiNewArray(componentType, dimensions);
        }
        public static native int getLength(Object array)
    throws IllegalArgumentException;    public static native Object get(Object array, int index)
      throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native boolean getBoolean(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native byte getByte(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native char getChar(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native short getShort(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native int getInt(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native long getLong(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native float getFloat(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native double getDouble(Object array, int index)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void set(Object array, int index, Object value)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setBoolean(Object array, int index, boolean z)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setByte(Object array, int index, byte b)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setChar(Object array, int index, char c)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setShort(Object array, int index, short s)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setInt(Object array, int index, int i)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setLong(Object array, int index, long l)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setFloat(Object array, int index, float f)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;    public static native void setDouble(Object array, int index, double d)
    throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
        private static native Object newArray(Class componentType, int length)
    throws NegativeArraySizeException;    private static native Object multiNewArray(Class componentType,
    int[] dimensions)
    throws IllegalArgumentException, NegativeArraySizeException;
    }
      

  6.   

    声明一个数组对象时,如:int[] a=new int[3];该如何调用该数组对象的实例字段和方法呢?
      

  7.   

    因为数组也是references,所以可以对a进行直接操作,其实A就是指向内存中的一个位置,这个位置开始存储你的INT型数据!
      

  8.   

    还是有点不太明白!int[] a=new int[3];a是不是对象啊?
    如果是的话,怎么调用它的实例字段和方法呢?谢谢!
      

  9.   

    int[] a=new int[3];a是不是对象啊?
    如果是的话,怎么调用它的实例字段和方法呢?谢谢!
      

  10.   

    int[] 的Class是Array的子类
    名字很特别,好像是[I这样的
    可以这样获得 (new int[2]).getClass()
      

  11.   

    int[] a=new int[3];a是对象啊?你这句话已经生成了一个int[]的对象了!a只有一个length的特别属性,其它的方法都继承于Object对象,应该没有其它的特别方法和属性了
      

  12.   

    数组是直接继承java.lang.Object对象而不是Array对象的!
         byte[] a = new byte[0];
         Class clz = a.getClass();
         System.out.println(clz.getSuperclass());返回的是class java.lang.Object
      

  13.   

    谢谢treeroot(根根)和ChDw(米) !谁能把数组类的源代码贴出来啊,不胜感激!
    注:不是Array类,而是int[] a=new int[3]中的数组类。
      

  14.   

    这个根本是由JVM来实现的!你无需要理会,这个类唯一你可以做的就是 两个
    byte[] a = new byte[100];
    int len = a.length;//返回长度
    byte b = a[99];//返回索引为99的成员
    除了Object所带的之外的其它什么属性方法你就别考虑了!!!!!!!!!!!!
      

  15.   

    java中所有的数组都是对象.都是数组类的实例.
      

  16.   

    第一个java虚拟机基本上是Smalltalk虚拟机的翻版,
    在Smalltalk中几乎所有的东西,像语句块、堆栈等都是对象,
    所以Java中应该绝大多数东西都是类或类的实例,好像也确实是这样。
    数组类是一个由虚拟机支持的特殊类,它是由操作码newarray创建的,是Array类的实例。
    一般对象是由操作码new创建的。
      

  17.   

    有点前言不搭后语:
    数组对象是由操作码newarray创建的,是Array类的实例。
      

  18.   

    "数组对象是由操作码newarray创建的,是Array类的实例。"但数组对象是这样创建的啊:int[] a=new int[];
    好像跟newarray、Array无关的啊?
      

  19.   

    就是啊 Array类 是不在java.lang 中的啊是不是就是这么特殊啊
      

  20.   

    int[] a=new int[3];a应该不是Array的对象
      

  21.   

    public final class Array extends Object  这句是JAVA-DOC里的原话。
    就但从这句话就可以看出Array不能再被继承,而且Array继承至Object,因此又具有Object所有方法。
    这个Array类在java.lang.reflect包里。The Array class provides static methods to dynamically create and access Java arrays.
    Array permits widening conversions to occur during a get or set operation, but throws an IllegalArgumentException if a narrowing conversion would occur.