Java Reference
In-Depth Information
The line numbers and colons along the left side of Listing A.1 are not part of the pro-
gram—they're included so that I can refer to specific lines by number in each program.
If you're ever unsure about the source code of a program in this topic, you can compare
it to a copy on the topic's official website at the following address:
A
After you finish typing in the program, save the file somewhere on your hard drive with
the name
HelloUser.java
. Java source files must be saved with the extension
.java
.
If you have created a folder called
J21work
, save
HelloUser.java
and all other Java source files from this topic in that folder. This
makes it easier to find them while using a command-line window.
TIP
If you're using Windows, a text editor such as Notepad might add an extra
.txt
file
extension to the filename of any Java source files you save. For example,
HelloUser.
java
is saved as
HelloUser.java.txt
. As a workaround to avoid this problem, place
quotation marks around the filename when saving a source file. Figure A.9 shows this
technique being used to save the source file
HelloUser.java
from Windows Notepad.
FIGURE A.9
Saving a source
file from Windows
Notepad.