|
Hour 2: Writing Your First Program
NOTES AND CORRECTIONS
SOURCE FILES
READER QUESTIONS
- Question: When I save a file with Windows Notepad, it
adds a
.txt file extension to the filename, as in
BigDebt.java.txt . How can I prevent this from
happening?
Answer: Put quote marks around the filename when you're
saving it, as in "BigDebt.java" . This prevents
Notepad from adding the .txt file extension to the
name. This problem does not occur under all Windows 95
configurations, but on those where it occurs, you won't be able to
compile the program unless you rename it to take out the
.txt file
extension.
- Question: In MS-DOS, I seem to recall that there is a
control key command to retype the previous line that you had typed
in. Do you happen to know that command?
Answer: After opening up an MS-DOS Prompt, enter the
command doskey . This causes the commands you type in
to be saved, and you can navigate backwards and forwards through
these saved commands by using the up arrow and down arrow keys on
your keyboard. This can be a timesaver as you're trying to fix a
Java program that won't compile successfully.
ACTIVITIES
- Solution #1: BiggerDebt.java
and BiggerDebt.class.
- Solution #2: Add errors to the BigDebt.java program and try to
compile the program. Compare the error messages to the errors that
you introduced in the program.
|