|
||
| |
Packaging Java classes | |
| Objective |
Organize Java classes into packages.
The package statement is used to identify the package to which a class belongs.
This statement must be placed at the beginning of the source code file for the class. Following is an example of a package statement: |
|
|
php, soa testing, oracle
surveillance, pmp, BACKHAUL package toys; |
||
|
Placed at the beginning of a source code file for a class, this statement indicates that the class belongs to the toys package. If you
wanted to include classes named finky and slinky in the toys package, you would place the above package statement
at the top of the source code files for each class.
|
||
|
Even though the package statement must be placed at the beginning of a source file, it
is okay to have comments appearing before it in the code.
|
||
| Quiz
Click the Quiz link below to test your knowledge of packages.
Java Classes Quiz |
||
|
|
||