January 2018
Intermediate to advanced
115 pages
1h 37m
English
Packages are used to avoid naming conflicts and to organize code files into different directories. So far in this book, the code file has been located at the root of the project’s source directory and has therefore belonged to the so-called default package . In Java, the directory a file belongs to, relative to the project’s source directory, corresponds to the package name.
To assign a code file to a package—for example, mypackage —it must be moved to a folder by that name, under the project directory. Furthermore, the file must specify which package it belongs to ...