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发行说明。
The Java platform is highly regarded in part because of its suitability for writing programs that use and interact with the resources on the Internet and the World Wide Web.Java平台之所以受到高度重视,部分原因是它适合编写使用Internet和万维网上的资源并与之交互的程序。In fact, Java-compatible browsers use this ability of the Java platform to the extreme to transport and run applets over the Internet.事实上,与Java兼容的浏览器将Java平台的这种能力发挥到极致,在Internet上传输和运行小程序。
This trail walks you through the complexities of writing Java applications and applets that can be used on the Internet.本教程将引导您了解编写可在Internet上使用的Java应用程序和小程序的复杂性。
➤ Overview of Networking网络概述 has two sections.它有两个部分。The first describes the networking capabilities of the Java platform that you may already be using without realizing that you are using the network.第一个描述了Java平台的网络功能,您可能已经在使用该平台,而没有意识到您正在使用网络。The second provides a brief overview of networking to familiarize you with terms and concepts that you should understand before reading how to use URLs, sockets, and datagrams.第二部分简要概述了网络,让您熟悉在阅读如何使用URL、套接字和数据报之前应该了解的术语和概念。
➤ Working With URLs使用URL discusses how your Java programs can use URLs to access information on the Internet.讨论Java程序如何使用URL访问Internet上的信息。A URL (Uniform Resource Locator) is the address of a resource on the Internet.URL(一致性资源定位器)是Internet上资源的地址。Your Java programs can use URLs to connect to and retrieve information over a network. This lesson provides a more complete definition of a URL and shows you how to create and parse a URL, how to open a connection to a URL, and how to read from and write to that connection.Java程序可以使用URL通过网络连接和检索信息。本课程提供了URL的更完整定义,并向您展示了如何创建和解析URL,如何打开到URL的连接,以及如何读取和写入该连接。
➤ All About Sockets关于套接字 explains how to use sockets so that your programs can communicate with other programs on the network.说明如何使用套接字,以便您的程序可以与网络上的其他程序通信。A socket is one endpoint of a two-way communication link between two programs running on the network.套接字是网络上运行的两个程序之间双向通信链路的一个端点。This lesson shows you how a client can connect to a standard server, the Echo server, and communicate with it via a socket.本课程介绍客户端如何连接到标准服务器Echo服务器,并通过套接字与之通信。It then walks you through the details of a complete client/server example, which shows you how to implement both the client side and the server side of a client/server pair.然后介绍完整的客户机/服务器示例的详细信息,该示例向您展示了如何实现客户机/服务器对的客户机端和服务器端。
➤ All About Datagrams关于数据报 takes you step by step through a simple client/server example that uses datagrams to communicate.通过一个使用数据报进行通信的简单客户机/服务器示例逐步介绍。It then challenges you to rewrite the example using multicast socket instead.然后,它要求您使用多播套接字重写示例。
➤ Programmatic Access to Network Parameters对网络参数的编程访问 explains why you might want to access network interface parameters and how to do so.解释您可能希望访问网络接口参数的原因和方法。It gives examples of how to list all the IP addresses assigned to the machine as well as other useful information such as whether the interface is running.它给出了如何列出分配给机器的所有IP地址以及其他有用信息(如接口是否正在运行)的示例。
➤ Working With Cookies处理Cookies discusses how cookies are used to create a session between a client and server, and how you can take advantage of cookies in your HTTP URL connections.讨论如何使用Cookie在客户端和服务器之间创建会话,以及如何在HTTP URL连接中利用Cookie。
Note that communications over the network are subject to approval by the current security manager.请注意,通过网络进行的通信需要得到当前安全经理的批准。The Security Manager describes what a security manager is and how it impacts your applications.安全管理器描述什么是安全管理器以及它如何影响您的应用程序。For general information about the security features provided by the JDK, refer to Security Features in Java SE.有关JDK提供的安全特性的一般信息,请参阅Java SE中的安全性功能。
The example programs in the following lessons that cover URLs, sockets, and datagrams are standalone applications, which, by default, have no security manager.以下课程中涉及URL、套接字和数据报的示例程序是独立的应用程序,默认情况下没有安全管理器。If you convert these applications to applets, they may be unable to communicate over the network, depending on the browser or viewer in which they are running.如果将这些应用程序转换为小程序,它们可能无法通过网络进行通信,具体取决于运行它们的浏览器或查看器。See What Applets Can and Cannot Do for information about the security restrictions placed on applets.有关小程序上的安全限制的信息,请参阅小程序可以做什么和不能做什么。