Java标准版有多少个类?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3112882/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How many classes are there in Java standard edition?
提问by Peter Krumins
I am curious how many classes are there in Java standard library. Perhaps someone knows an approximate number?
我很好奇 Java 标准库中有多少个类。也许有人知道一个大概的数字?
采纳答案by Chadwick
By counting entries in the 'all classes' frame of the javadoc API:
通过计算 javadoc API 的“所有类”框架中的条目:
4569
in java 144545
in java 134433
in java 124411
in java 116002
in java 106005
in java 94240
in java 84024
in java 73793
in java 63279
in java 5.02723
in java 1.4.2*1840
in java 1.3.1*
4569
在Java 14 中4545
在Java 13 中4433
在Java 12 中4411
在Java 116002
在Java 10 中6005
在Java 94240
在Java 8 中4024
在Java 73793
在Java 63279
在Java 5.0 中2723
在Java 1.4.2*1840
在Java 1.3.1*
* Javadocs prior to 5.0 are now offline.
* 5.0 之前的 Javadoc 现在离线。
回答by Ben S
回答by sepp2k
According to the API documentation 3793 including abstract classes and interfaces.
根据 API 文档 3793 包括抽象类和接口。
回答by emory
I counted 17,338 in Java 6.0. My methodology:
我在 Java 6.0 中数了 17,338。我的方法论:
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.
我删除了与清单相关的两行(因此不代表一个类)。我相信其他行都是指类,但我没有做详尽的检查。然后我转到文件底部,emacs 告诉我有 17,338 行。
This includes stuff like: java/io/ObjectOutputStream$1.class.
这包括以下内容:java/io/ObjectOutputStream$1.class。
回答by Shrikant Kale
- 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
- Java 1.0.2:250 个类
- Java 1.1:500 个类
- Java 2(版本 1.2-1.4):2300 个类
- Java 5.0(1.5 版):3500 个类
Source : Head First 2nd edition, Chapter 1, p. 4
资料来源:Head First 2nd edition, Chapter 1, p. 4
回答by Do Nhu Vy
I'm also curious about this topic. I found this:
我也对这个话题很好奇。我找到了这个:
(source: Java 8 Pocket Guidebook by Robert Liguori, Patricia Liguori)
(来源:Java 8 袖珍指南,Robert Liguori、Patricia Liguori)
回答by Vivek Vermani
I see 3762 within Java 8 as following
我在 Java 8 中看到 3762 如下
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
此外,这是每个版本引入的类/接口列表 - http://qr.ae/Q2baW
回答by Rakesh Yadav
回答by yoborider
For Java SE 9 , according to the API doc 6005 including abstract and interfaces.
对于 Java SE 9,根据 API doc 6005 包括抽象和接口。
For Java SE 10, according to the API doc 6002 including abstract and interfaces.
对于 Java SE 10,根据 API doc 6002 包括抽象和接口。
https://docs.oracle.com/javase/10/docs/api/allclasses-noframe.html
https://docs.oracle.com/javase/10/docs/api/allclasses-noframe.html
Method : view source, and count "<li>" html tag with notepad++.
方法:查看源码,用notepad++统计“<li>”html标签。
For Java SE 11, according to the API doc 4411 including abstract and interfaces.
对于 Java SE 11,根据 API doc 4411,包括抽象和接口。
For Java SE 12, according to the API doc 4433 including abstract and interfaces.
对于 Java SE 12,根据 API doc 4433 包括抽象和接口。
https://docs.oracle.com/en/java/javase/12/docs/api/allclasses-index.html
https://docs.oracle.com/en/java/javase/12/docs/api/allclasses-index.html
Method : view source, and count "colFirst" css class with notepad++
方法:查看源代码,并使用记事本++计算“colFirst”css类