The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
A package is a namespace that organizes a set of related classes and interfaces.包是组织一组相关类和接口的命名空间。Conceptually you can think of packages as being similar to different folders on your computer.从概念上讲,您可以认为软件包类似于计算机上的不同文件夹。You might keep HTML pages in one folder, images in another, and scripts or applications in yet another.您可以将HTML页面保存在一个文件夹中,将图像保存在另一个文件夹中,将脚本或应用程序保存在另一个文件夹中。Because software written in the Java programming language can be composed of hundreds or thousands of individual classes, it makes sense to keep things organized by placing related classes and interfaces into packages.因为用Java编程语言编写的软件可以由成百上千个单独的类组成,所以通过将相关的类和接口放入包中来保持组织是有意义的。
The Java platform provides an enormous class library (a set of packages) suitable for use in your own applications.Java平台提供了一个巨大的类库(一组包),适合在您自己的应用程序中使用。This library is known as the "Application Programming Interface", or "API" for short.该库称为“应用程序编程接口”,简称“API”。Its packages represent the tasks most commonly associated with general-purpose programming.它的包代表了最常见的与通用编程相关的任务。For example, a 例如,String
object contains state and behavior for character strings; a File
object allows a programmer to easily create, delete, inspect, compare, or modify a file on the filesystem; a Socket
object allows for the creation and use of network sockets; various GUI objects control buttons and check boxes and anything else related to graphical user interfaces.String
对象包含字符串的状态和行为;File
对象允许程序员轻松地创建、删除、检查、比较或修改文件系统上的文件;Socket
对象允许创建和使用网络套接字;各种GUI对象控制按钮和复选框以及与图形用户界面相关的任何其他内容。There are literally thousands of classes to choose from.实际上有成千上万的类可供选择。This allows you, the programmer, to focus on the design of your particular application, rather than the infrastructure required to make it work.这使程序员能够专注于特定应用程序的设计,而不是使其工作所需的基础设施。
The Java Platform API Specification contains the complete listing for all packages, interfaces, classes, fields, and methods supplied by the Java SE platform.Java平台API规范包含Java SE平台提供的所有包、接口、类、字段和方法的完整列表。Load the page in your browser and bookmark it.在浏览器中加载页面并将其添加到书签中。As a programmer, it will become your single most important piece of reference documentation.作为程序员,它将成为您最重要的参考文档。