About the package

About java packages

A package is a mechanism for classifying java classes together.

If there are a large number of classes, it will be easier to manage the classes that are grouped together by classifying them by function.

Package declaration How to use

By declaring (package) at the beginning of a class, you can specify the package to which the class is classified.

package pack;

If no package is specified, it will be classified as the default package.

If you specify a package, the source files for that class must be stored in a folder with the same name as the specified package.

If you move the file, you need to change the package declaration in the source as well.

Classes in the same package can be accessed only by the class name.

However, if you want to access a class outside the package, you need to specify the location of the target class with an import statement.


import pack;

The package can create layers. For packages consisting of multiple layers, concatenate the package names in order from the top of the layers with (.).


package packA.packB.packC;

Recommended Posts

About the package
About the method
Output about the method # 2
About the StringBuilder class
Commentary: About the interface
About the asset pipeline
About the function double-java
About the length method
About the Kernel module
About the authenticate method.
About the ancestors method
[Output] About the database
About the [ruby] operator
About the to_s method.
About the handling of Null
About specifying the JAXRS path
Output about the method Part 1
A note about the scope
About the description of Docker-compose.yml
About the File :: Stat class
About the same and equivalent
About the Android life cycle
About the explanation about functional type
About =
Consideration about the times method
About the language to be learned
The org.junit.jupiter.api package cannot be found.
About the basics of Android development
[Rails] About the Punk List function
About the equals () and hashcode () methods
About the symbol <%%> in Rails erb
About the information sharing app band
A murmur about the utility class
About the role of the initialize method
Summary about the introduction of Device
About the log level of java.util.logging.Logger
About method.invoke
About Kotlin
About attr_accessor
About the version of Docker's Node.js image
Guess about the 2017 Java Persistence Framework (3) Reladomo
About inheritance
About params
About Docker
Check once again about the OpenSSL command
What is testing? ・ About the importance of testing
When updating my own application, I seriously thought about the package structure
About Rails 6
About form_for
About the procedure for java to work
About Spring ③
About enum
About polymorphism
About Optional
About hashes
About JitPack
About the operation of next () and nextLine ()
About Dockerfile
About this ()
Install the package with npm install / yarn add
About devise