A Java program is organized into classes; the entry point is the public static void main(String[] args) method. The source code (.java) is compiled into bytecode (.class) by javac, then run by the Java Virtual Machine (JVM), which makes it portable. Each public class has a file of the same name.
Example
public class Main {
public static void main(String[] args) {
System.out.println("Hello");
}
}