The following application prints "Hello World!" to the console.
public class HelloWorldApp {
public static void main(String args[]) {
System.out.println("Hello World!");
}
}
Important Note: the name of the program must have the same name as the public class followed by a .java extension, in this case HelloWorldApp.java.
To compile this program, type:
javac HelloWorldApp.java
To run with the interpreter, type:
java HelloWorldApp
The program should print out the message "Hello World!" to the console.
![]() |