Java · Course navigation

Java Basics

Start with a class and main method.

On this page

The concept

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

Code example

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

Follow the code

Open the walkthrough to inspect the example one step at a time.

Show guided walkthrough
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

Behind the scenes

How Java processes this code

The Java compiler produces bytecode. The JVM loads the class and invokes its main method.