The Scrapbook is a window that helps you organize, develop, and test ideas for your Java programs. In the Scrapbook, you can experiment with Java code fragments without specifying a containing class. The Scrapbook can have several pages. Contents of the pages may be saved to files, but are not saved in the repository.
The Compilation Context
The compilation context is the class you choose to contain the Java code fragment
when you compile and run it. When you evaluate code in the Scrapbook, it is treated
as though it were part of the compilation context, so the code inherits any imports from
the selected class. It can also refer to protected or private fields and methods in
the class and nonpublic classes in the same package.
Each Scrapbook page has its own compilation context, and does not interfere with other pages, so you can do things such as test the client and server parts of a program. The default compilation context is java.lang.Object.
Other Uses for the Scrapbook
The Scrapbook can open, read, and save to text-based files, including .java files, from
the file system. It supports a variety of formats and origins, including NT, OS/2,
UNIX-based, Solaris, and Macintosh. You can run Java code that is in any of these
types of files.
You can import Java code from these files into a class, interface, or method in the workspace.
The Scrapbook is also useful as a simple text editor for viewing and editing text-based files within the file system, and for making notes to yourself.
Organizing Your Ideas in the Scrapbook
Experimenting with Code Fragments