开发者

How many classes are there in Java standard edition?

I am curious how many classes are there in Java standard library. Perhaps someone knows an approxim开发者_StackOverflowate number?


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.


I'm also curious about this topic. I found this:

How many classes are there in Java standard edition?

(source: Java 8 Pocket Guide book by Robert Liguori, Patricia Liguori)


  • Java 1.0.2 : 250 classes
  • Java 1.1 : 500 classes
  • Java 2 (version 1.2-1.4) : 2300 classes
  • Java 5.0 (version 1.5) : 3500 classes

Source : Head First 2nd edition, Chapter 1, p. 4


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.


I see 3793 counting interfaces and abstract classes, as well as private classes.


I see 3762 within Java 8 as following

All Classes ( Outer as well as Inner ) , Enums and Interfaces -  3762
All except Inner Classes                                      -  3462
Only Classes ( Outer + Inner + Abstract + Enum )              -  2963
Interfaces                                                    -  799
Enum                                                          -  93  

Moreover , Here is the list of classes / interfaces introduced with each version - http://qr.ae/Q2baW


Calculating classes and subclasses is a cumbersome task, but you can know the number of files. 4240 total files in Jdk 8. Click here for the list of all files.


For Java SE 9 , according to the API doc 6005 including abstract and interfaces.

For Java SE 10, according to the API doc 6002 including abstract and interfaces.

https://docs.oracle.com/javase/10/docs/api/allclasses-noframe.html

Method : view source, and count "<li>" html tag with notepad++.

For Java SE 11, according to the API doc 4411 including abstract and interfaces.

For Java SE 12, according to the API doc 4433 including abstract and interfaces.

https://docs.oracle.com/en/java/javase/12/docs/api/allclasses-index.html

Method : view source, and count "colFirst" css class with notepad++


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜