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发行说明。
To create a package for a type, put a 要为类型创建包,请将package
statement as the first statement in the source file that contains the type (class, interface, enumeration, or annotation type).package
语句作为包含该类型(类、接口、枚举或注释类型)的源文件中的第一条语句。
To use a public type that's in a different package, you have three choices: (1) use the fully qualified name of the type, (2) import the type, or (3) import the entire package of which the type is a member.要使用另一个包中的公共类型,您有三种选择:(1)使用类型的完全限定名,(2)导入类型,或(3)导入类型为其成员的整个包。
The path names for a package's source and class files mirror the name of the package.包的源文件和类文件的路径名镜像了包的名称。
You might have to set your 您可能必须设置CLASSPATH
so that the compiler and the JVM can find the .class
files for your types.CLASSPATH
,以便编译器和JVM能够找到您的类型的.class
文件。