Java Reference
In-Depth Information
public class
ClassName
{
. . .
{
as a necessary part of the Ȓplumbingȓ that is required to write any Java program. In
Java, every source file can contain at most one public class, and the name of the public
class must match the name of the file containing the class. For example, the class
HelloPrinter
must be contained in a file
HelloPrinter.java
. It is very
important that the names and the capitalization match exactly. You can get strange
error messages if you call the class
HELLOPrinter
or the file
helloprinter.java
.
Figure 10
Running the
HelloPrinter
Program in a Console Window
18