为什么要导入javax.swing。*而不是java.swing。* [英] Why import javax.swing.* instead of java.swing.*
问题描述
我不明白为什么在java中为少数导入包添加了x。是什么原因?不能只是 java.swing。*
和其他人一样 java.io。*
?
I did not understand why there is "x" appended to "java" for few of the import packages. What is the reason? Can't it be just java.swing.*
like others java.io.*
?
推荐答案
Swing最初是Java的扩展 - 一个可单独下载的库。它成为Java 1.2中主要JRE的一部分。如果一个单独的库声称一个java。*包,那将是奇怪的,因此目前的情况。还有很多其他扩展也有类似的故事。
Swing was originally an extension to Java - a separately downloadable library. It became part of the "main" JRE in Java 1.2. It would have been odd for a separate library to have claimed a java.* package, hence the current situation. There are plenty of other extensions which have a similar story.
The Wikipedia article on Swing has a bit more information on its history.
这篇关于为什么要导入javax.swing。*而不是java.swing。*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!