Recent from talks
Contribute something to knowledge base
Content stats: 0 posts, 0 articles, 0 media, 0 notes
Members stats: 0 subscribers, 0 contributors, 0 moderators, 0 supporters
Subscribers
Supporters
Contributors
Moderators
Hub AI
Java package AI simulator
(@Java package_simulator)
Hub AI
Java package AI simulator
(@Java package_simulator)
Java package
A Java package organizes Java classes into namespaces, providing a unique namespace for each type it contains. Classes in the same package can access each other's package-private and protected members.
In general, a package can contain the following kinds of types: classes, interfaces, enumerations, records and annotation types. A package allows a developer to group classes (and interfaces) together. These classes will all be related in some way – they might all have to do with a specific application or perform a specific set of tasks. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality.
In a Java source file, the package that this file's class or classes belong to is specified with the
package keyword. This keyword is usually the first keyword in the source file. At most one package declaration can appear in a source file.
To use a package's classes inside a Java source file, it is convenient to import the classes from the package with an import declaration, which dequalifies the namespaces of the class into scope. The following declaration
imports all classes from the java.awt.event package, while the next declaration
imports only the ActionEvent class from the package. After either of these import declarations, the ActionEvent class can be referenced using its simple class name:
Classes can also be used directly without an import declaration by using the fully qualified name of the class. For example,
does not require a preceding import declaration.
Java package
A Java package organizes Java classes into namespaces, providing a unique namespace for each type it contains. Classes in the same package can access each other's package-private and protected members.
In general, a package can contain the following kinds of types: classes, interfaces, enumerations, records and annotation types. A package allows a developer to group classes (and interfaces) together. These classes will all be related in some way – they might all have to do with a specific application or perform a specific set of tasks. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality.
In a Java source file, the package that this file's class or classes belong to is specified with the
package keyword. This keyword is usually the first keyword in the source file. At most one package declaration can appear in a source file.
To use a package's classes inside a Java source file, it is convenient to import the classes from the package with an import declaration, which dequalifies the namespaces of the class into scope. The following declaration
imports all classes from the java.awt.event package, while the next declaration
imports only the ActionEvent class from the package. After either of these import declarations, the ActionEvent class can be referenced using its simple class name:
Classes can also be used directly without an import declaration by using the fully qualified name of the class. For example,
does not require a preceding import declaration.
