Introduction to Interactive Programming
by Lynn Andrea Stein
A Rethinking CS101 Project

Java Charts

Program File

A program file (.java) contains:

package packageName; Optional: 0 or 1 occurences.

If present, this file is a part of the package named packageName and must appear in an appropriately named sub-directory.

import importableObject;
Optional: 0 or more occurrences.

Import statements do not affect visibility. They serve only to allow more concise naming, i.e., elimination of packageName before a class or interface name reference.

importableObject may be either packageName.ClassOrInterfaceName or packageName.
The first form allows ClassOrInterfaceName to be used as a shorthand for packageName.ClassOrInterfaceName ; the second allows any (visible) names within packageName to be used without explicitly giving the packageName.

class (or interface) definition(s) 1 or more, but at most 1 may be public, and the name of any public class or interface must correspond to the filename (without the .java)


© 1999 Lynn Andrea Stein

This chapter is excerpted from a draft ofIntroduction to Interactive Programming In Java, a forthcoming textbook from Morgan Kaufmann Publishers, Inc. It is a part of the course materials developed as a part of Lynn Andrea Stein's Rethinking CS101 project at the MIT AI Lab and the Department of Electrical Engineering and Computer Science at the Massachusetts Institute of Technology.

Questions or comments:
<cs101-webmaster@ai.mit.edu>
Last modified: Thu Jul 10 13:01:20 1997