Introduction
Java was released by Sun Microsystems in 1995 with the promise "write once, run anywhere." Java code compiles to bytecode, which runs on the Java Virtual Machine (JVM) — so the same compiled program runs unchanged on Windows, macOS, or Linux.
Java is widely used for Android apps, enterprise backend systems, and large-scale software where reliability matters.
Syntax
public class ClassName {
public static void main(String[] args) {
// your code here
}
}Example
Every Java program's entry point is public static void main(String[] args) inside a class whose name matches the filename.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}Try it yourself
Copy this example into the Java compiler and run it — try changing a value and see what happens.
