Java Reference
In-Depth Information
9.
You're ready to run your program now. Enter the following prompt and press Enter:
java -cp . MyFirstApplication
10. You should end up with something like Figure 3-2 in the end.
figure 3-2  
How It Works
Here's how it works:
1.
In Java, source code is saved in .java files that may contain one or more classes or other types
that you will learn more about later in this topic, such as interfaces, enums, and annotations. Each
source code file can contain at most one public access type and any number of non‐public types.
When your compilation unit contains a public access type, like the public class in this exercise, both
the type and the .java file must have the same name. You declared a public type with the name
MyFirstApplication and stored it in a .java source code file called MyFirstApplication.java .
2.
The first few lines of code start with /** and end with */ . These are special symbols that indi-
cate a block comment. Comments are not compiled or executed, so they allow you to provide
Search WWH ::




Custom Search