Home  >  Article  >  Java  >  What's in the java package

What's in the java package

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-12-09 16:47:093115browse

What's in the java package

In order to better organize classes, Java provides a package mechanism. Packages are containers of classes that separate class namespaces. If no package name is specified, all examples belong to a default unnamed package. Packages in Java generally contain related classes. For example, all classes related to transportation can be placed in a package named Transportation.

Programmers can use package to indicate which specific package the class in the source file belongs to. The format of the package statement is:

package pkg1[.pkg2[.pkg3…]];

Five commonly used packages in Java:

java.lang.*

Provides programming using Java The basic classes for programming in the language. The most important classes are Object (which is the root of the class hierarchy) and Class (instances of which represent classes in a running application).

java.util.*

Contains the collection framework, legacy collection classes, event model, date and time facilities, internationalization and various utility classes (string tokenizer, random Number generator and bit array, Date class, Stack class, Vector class, etc.). Various common toolkits such as collection classes, time processing modes, date and time tools, etc.

java.io.*

Java's core library java.io provides a comprehensive IO interface. Including: file reading and writing, standard device output, etc. IO in Java is based on streams for input and output. All data is serialized and written to the output stream, or read from the input stream.

java.net.*

Not all systems support the IPv6 protocol and it can also be disabled using a system property while the Java networking stack attempts to detect it and use it transparently when available it. When IPv6 is unavailable or explicitly disabled, Inet6Address is no longer a valid parameter for most network connection operations. Although methods like java.net.InetAddress.getByName are guaranteed not to return an Inet6Address when looking up a hostname, it is still possible to create such an object by passing a literal value. In this case, most methods will throw an exception when called with Inet6Address.

java.sql.*

Provides an API for using the JavaTM programming language to access and manipulate data stored in a data source (usually a relational database). This API includes a framework that enables you to dynamically install different drivers to access different data sources.

PHP Chinese website has a large number of free JAVA introductory tutorials, everyone is welcome to learn!

The above is the detailed content of What's in the java package. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn