Your First Java Program
Let's write the traditional "Hello, World!" program.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Breaking it Down
How to Run
HelloWorld.java.javac HelloWorld.java (Creates HelloWorld.class).java HelloWorld (Outputs: Hello, World!).Frequently Asked Questions
What is the main method?
public static void main(String[] args) is the entry point of any Java application.