Home Segments Top Top Previous Next

644: Mainline

One way to bring together classes into modules is to define them in the same file. Note, however, that only one such class can be public—the one whose name is the same as the name of the file.

You could, for example, bring the Demonstrate, Auxiliaries, Attraction, Movie, and Symphony classes into one file, named Demonstrate, with only Demonstrate marked as public.

Because all classes in a file are compiled together, with all class names accessible in all other classes, files are said to be compilation units.