This exercise will show you the detailed steps you must follow to create your first Java program.
Launch Notepad. (Start Menu | All Programs | Accessories | Notepad)
Then, type in the code listed below. Save your file as "FirstProg.java".
Keep Notepad open; you will need it again if there are errors.
Open a command prompt. (Start Menu | All Programs | Accessories | Command Prompt) Then type, in order, the commands below.
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\>u: U:\>cd My Documents U:\My Documents>cd CompSci U:\My Documents\CompSci>javac FirstProg.java U:\My Documents\CompSci>
If the command appears to do nothing, then it's working correctly! If it gives errors, though, then something is wrong. Look back at your code and fix any differences.
Once the compiling step (javac) completes with no errors, then your new program is ready to run!
U:\My Documents\CompSci>java FirstProg Mr. Mitchell is cool. U:\My Documents\CompSci>
You did it! Now try changing the code so that the computer displays a different message.
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.