Program Structure and the Entry Point

A Java program is organized around types such as classes, interfaces, enums, and records. A conventional executable application has a main method. The usual entry point is public static void main(String[] args).

public makes the method accessible to the launcher, static means the JVM can invoke it without creating an instance, void means it returns no value, and String[] args receives command-line arguments.

Java identifiers are case-sensitive. Package names are conventionally lowercase, classes use PascalCase, methods and variables use camelCase, and constants commonly use UPPER_SNAKE_CASE.

package com.example.app;

public class Application {
    private static final int DEFAULT_PORT = 8080;

    public static void main(String[] args) {
        System.out.println("Starting on port " + DEFAULT_PORT);
    }
}
Key Takeaways
  • Java is case-sensitive.
  • The main method is a static entry point for conventional command-line applications.
  • Packages provide namespace organization and support access control.