Sample Java Program Hello.java
class Hello
{
public static void main ( String[ ] args )
{
System.out.println(“Hello World!”);
}
}
Execute Program on the Command Interpreter
1. Type javac Hello.java to compiler the source code, the Bytecode file
Hello.class will be generated if there are no errors.
2. Type java Hello to run the program
Edit, Compile and Run Cycle
1. Edit the program using Notepad.
2. Save the program to the disk
3. Compile the program with the javac command.
4. If there are syntax errors, go back to step 1.
5. Run the program with the java command.
6. If it does not run correctly, go back to step 1.
7. When it runs correctly, quit.