数组不是对象,他是与类、接口、基本数据类型同级的java里面的语法对象
但是你说得
java.lang.reflect.Array
java.sql.Array
java.util.Arrays
就是类了,不过那几个类是对数组做操作的

解决方案 »

  1.   

    谢谢,dooby(德鲁比) 那数组为什么也能用toString(),getClass()这些方法呢?
      

  2.   

    toStringt(),getClass()这些方法都是在Object对象中定义的,由于java是单根系统所以,大家都继承它,自然这些方法可以使用。但是由于object中只定义了基本的方法。所以取出来的并不是你真实想要的。
      

  3.   

    数组怎么会不是对象呢???
      《Java 虚拟机规范》中是这样写的: java数组是对象,被动态地创建,并且可以赋给Object类型的变量。类Object的所有方法都可以在数组上调用。         数组只是在定义,和取值的时候和一般的对象不同,但它本质上和其他的对象是一样的。java编译器和解释器把它“封装”起来了,它是继承自Object, 只不过没把“数组”这种对象在api中显式的列出来罢了!
      

  4.   

    是不是对象,不能评论,感觉是。
    toStringt(),getClass()都是继承Object对象的方法
    自然可以用了
      

  5.   

    to 楼主:
    同意 huidaoren(huidaoren).
    给大家引用一段来自<The Java Programming Language> P.148. (作者之一是James Gosling,相信大家不再怀疑它的权威了吧)Arrays provide ordered collections of elements. Components of an array can be primitive types or references to objects, including references to other arrays. Arrays themselves are objects and extent Object. (请看最后一句,我英文一般就不翻译了,但是我相信大家都看得明白)Arrays are implicit extensions of Object.Like any other object, arrays are created and are subject to normal garbage collection mechanisms. They inherit all of the methods of Object and additionally they implement the Coloneable interface.
    (以上是说数组和别的对象一样,可以被垃圾回收.数组继承所有Object的方法并且实现了克隆接口)The major limitation on the "object-ness" of arrays is that they cannot be extended to add new methods.
    说数组不能再被派生了.
    class ScaleVector extends double[] { // INVALID
        // ...
    }这下应该明白数组了吧. :)