Java, javax, org, Sun, java.util and other common packages of the differences, detailed, examples

Source: Internet
Author: User

Java, javax, org, and sun packages are all class packages provided by the JDK and are all in Rt.jar. Rt.jar is the Java base Class library (a very important package in the Java Core framework), which contains most of the functions of Lang, and Rt.jar default is in the load path of the root ClassLoader, so classpath is superfluous. The differences between them are specific as follows:

1. Java.*

Java SE's standard library, which is part of the Java standard, is a externally-committed Java development interface that is generally backward compatible and is not easily modified. All JDK implementations, including other manufacturers (IBMJDK/HPJDK/OPENJDK), are the same on java.*.

2. javax.*

is also part of the Java standard, but is not included in the standard library and is typically an extension of the standard library. Usually belong to a particular domain, not a generic API.
So the API is provided in an extended manner to avoid the JDK's standard library being too large. Of course some of the early javax were later incorporated into the standard library, and all should also belong to the new version of the JDK's standard library. For example, Jmx,java 5 was previously provided as an extension, but Jdk5 is part of the standard library, and all javax.management are part of the JDK5 standard library.

3. com.sun.*

is the implementation class for Java.* and javax.* in Sun's hotspot virtual machine. Because it is included in the RT, we can also invoke it. However, because it is not the interface of Sun's external commitment, it can be increased or decreased according to the needs of the implementation, so it may be different in different versions of the hotspot, and it is not in the other JDK implementations, calling these classes may not be backwards compatible, so it is generally not recommended.

4. org.*

Is the Java class Library provided by the Enterprise or the organization, most of it is not provided by Sun Company, with com.sun.*, do not have backward compatibility, will increase or decrease as needed. Among the more commonly used are the XML, Web pages, server classes, and interfaces provided by the website.

Specifically, the following table:

Package Name Description
Java.lang The package provides basic Java programming classes, such as Object, Math, String, StringBuffer, System, thread, and so on, which makes it difficult to write Java code without using the package.
Java.util The package includes a collection framework, legacy collection classes, event models, date and time implementations, internationalization, and various utility classes (string tag generator, random number generator, and bit array).
java.io The package provides input and output of the system through file system, data flow and serialization.
java.net The package provides classes for implementing network applications and development.
java.sql The package provides access to and processing of data APIs stored in a data source (typically a relational database) using the Java language.
java.awt These two packages provide a class of GUI design and development. The java.awt package provides all the classes for creating an interface and drawing graphics images, while the Javax.swing package provides a set of "lightweight" components that try to make these components work the same way on all platforms.
Javax.swing
Java.text

provides classes and interfaces for working with text, dates, numbers, and messages in a way that is not related to natural language.

Java.lang Explanation: http://beyond429.iteye.com/blog/344024

Java.util Explanation: http://blog.csdn.net/abeetle/article/details/1497706

java.io Explanation: http://blog.csdn.net/yczz/article/details/38761237

java.net Explanation: https://zhidao.baidu.com/question/87061018.html

java.sql Explanation: http://www.360doc.com/content/12/0329/09/1200324_198823027.shtml

java.awt Explanation: http://blog.csdn.net/u013147587/article/details/49815031

Javax.swing Explanation: http://blog.sina.com.cn/s/blog_4a7979120100087g.html

Java.text Explanation: http://www.cnblogs.com/beibeibao/p/3411750.html

Java, javax, org, Sun, java.util and other common packages of the differences, detailed, examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.