How does array class work in Java?

后端 未结 4 1231
感动是毒
感动是毒 2020-12-10 16:52

In Java, array is a class and extends Object. I am curious to know about this special array class. I don\'t find the class definition anywhere. Doing a getClass().getNam

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 17:27

    The Java Virtual Machine Specification explains in section 4.2 what names such as [Ljava.lang.String; mean. See: 4.2 The Internal Form of Fully Qualified Class and Interface Names.

    In this case the [ means this is an array type, and Lclassname; indicates that this is an array of references to objects of type classname.

    So [Ljava.lang.String; means String[].

提交回复
热议问题