How many classes are there in Java standard edition?

后端 未结 9 2064
逝去的感伤
逝去的感伤 2020-12-13 13:00

I am curious how many classes are there in Java standard library. Perhaps someone knows an approximate number?

相关标签:
9条回答
  • 2020-12-13 13:23

    By counting entries in the 'all classes' frame of the javadoc API:

    • 4569 in java 14
    • 4545 in java 13
    • 4433 in java 12
    • 4411 in java 11
    • 6002 in java 10
    • 6005 in java 9
    • 4240 in java 8
    • 4024 in java 7
    • 3793 in java 6
    • 3279 in java 5.0
    • 2723 in java 1.4.2*
    • 1840 in java 1.3.1*

    * Javadocs prior to 5.0 are now offline.

    0 讨论(0)
  • 2020-12-13 13:25

    According to the API documentation 3793 including abstract classes and interfaces.

    0 讨论(0)
  • 2020-12-13 13:26

    I counted 17,338 in Java 6.0. My methodology:

    jar -tf ${JAVA}/jre/lib/rt.jar > rtjar.txt
    emacs rtjar.txt
    

    I deleted two lines related to the manifest (and thus not representing a class). I believe that the other lines all refer to classes, but I did not do an exhaustive check. Then I went to the bottom of the file and emacs told me that there 17,338 lines.

    This includes stuff like: java/io/ObjectOutputStream$1.class.

    0 讨论(0)
提交回复
热议问题