Our first program in T411
Write the program in Notepad
- Fire up Notepad
start → Accessories → Notepad
(Sometimes Accessories is a folder on the desktop)
- This should bring up Notepad:
- Now type in the text for the program:
Important: Java is case-sensitive, so be
careful to capitalize where shown.
- Use Save as... and save the file as
HelloWorld.java in your T: drive.
(You may need to click on "My Computer" on the left to
see the drive.)
Important: the filename is also case-sensitive.
- Leave Notepad as is for now.
Compile the program
- Go to start → Run and type in cmd:
- In the command-prompt window, type in T: (with the colon)
to put you in the T: drive.
- Now list the files in there by typing dir
and you should see HelloWorld.java:
- Next, compile the Java program by typing
javac HelloWorld.java
- You will note that nothing appears to happen
=> Later, we will learn that this is a good thing (no errors reported)
Execute the program
- Execute the program by typing java HelloWorld
at the command-prompt:
- This time there was something that printed to the screen:
"Hello World!".
- Why did that happen?
=> Because that was the intent of the program