O'Reilly logo

Java™ Phrasebook by Timothy Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Package

package com.timothyfisher.book;

In a large application or library, Java classes are usually organized into packages. To put a class into a package, you simply include a package statement, such as the one shown in this phrase, at the beginning of the class file. The package statement must be the first non-comment line of a class file. The example in this phrase would assign the class contained in the file to the package com.timothyfisher.book.

The package name of a class becomes a part of its full name. For example, if we had a class named MathBook in the com.timothyfisher.book package, the fully specified class name would be com.timothyfisher.book.MathBook. Package names also dictate the directory structure in which the class ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required