Reprint Address: http://www.cnblogs.com/Coda/p/4346151.html
Java know how much (8) class library and its organizational structure
Java officially provides developers with a number of powerful classes that are placed in individual packages and published with the JDK, called Java class libraries or Java APIs.
API (Application Programming Interface, Application programming Interface) is a common concept.
For example, I have written a class that can get a variety of computer hardware information, it is very strong and stable, if your project also requires such a function, then you do not have to write your own code, my class to be used directly. However, my class code is very complex, so you can read the code is not very realistic, and I do not want you to see my code (you do not need to read these obscure code), I want to protect my copyright, how to do?
I can first compile my class and come with a document that tells you how my class is used, what methods and properties you just need to follow the document's instructions, which saves you time in reading the code and protects my copyright. For example, how to obtain CPU information:
Getcpuinfo (int cputype);
This is an API. In other words, the use of the classes described in this document is called an API.
I can also develop a software to clean up the garbage files on the computer, I have a good heart, I want to let more developers use my software, I will release the software with a description of the document, and tell you how to call in your own program, which is also called the API.
Select the corresponding version of Java, click on the link to enter. The API address for J2SE 1.7 is: http://docs.oracle.com/javase/7/docs/api/
This document is online and will be updated by the official at any time. Of course you can also download to the local, please everyone own Baidu how to download.
Open the API documentation for J2SE 1.7 as shown in:
Figure 1 API Documentation
There are many packages in the Java class Library:
- Java.* begins with Java's core package, and all programs use the classes in those packages;
- Javax.* begins with an expansion package, and X is the meaning of extension, which is the extension. Although javax.* is optimized and extended for java.*, many programs rely on javax.* because javax.* is used more and more, so javax.* is also part of the core and is released with the JDK.
- Starting with org.* is a package that is released by various agencies or organizations, because these organizations are very influential and their code quality is high, so they also publish some of the commonly used classes they develop with the JDK.
In the name of the package, in order to prevent the same name, there is a convention: we all use the inverted form of their domain names as the beginning to the development of their own package name, for example, Baidu released the package will start with the com.baidu.*, the group released the package will start with org.w3c.*, micro-school issued by the package will be net.weixueyuan.* start ...
Organization of the domain name suffix is generally org, the company's domain name suffix is generally com, you can think of org.* beginning of the package for non-profit organizations issued packages, they are generally open source, can be used free of charge in their own products, regardless of infringement issues, and com.* beginning of the package is often issued by the company's profit , there may be copyright issues, to be aware of when using.
Some of the packages commonly used in Java are:
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. |
Please refer to the API documentation for more packages and instructions.
Series Articles:
Java know how much (1) Language overview
Java know how much (2) virtual machine (JVM) and cross-platform principle
Java know how much (3) employment direction
Java know how much (4) the difference between J2SE, Java EE, J2ME
Java know how much (5) Build Java development environment
Java know how much (6) The first example of a program
Java knows how many (7) classes and objects
Java know how much (8) class library and its organizational structure
Reprint: Java know how much (8) class library and its organizational structure