Java Basics

Start with a class and main method.

Java
class Main {
  public static void main(String[] args) {
    System.out.println("Hello Programonic");
  }
}
Output
Hello Programonic

Explanation

Java code lives in classes. The main method is the entry point, and System.out.println prints a line.

Explore the dry run
Guided walkthroughReady
1class Main {
2 public static void main(String[] args) {
3 System.out.println("Hello Programonic");
4 }
5}

Follow the example

Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.

View the complete dry-run table
Prepared trace of the published program. Some rows group repeated iterations.
Step / lineWhat happensState after stepOutput so far
The JVM enters the main method.—
—
println writes the message and a newline.—
Hello Programonic