Java quick reference
Java 25 essentials: the main class, types and variables, control flow and switch expressions, methods, classes and records, collections, strings, input and files — and how javac and the JVM run your project in Zerethon IDE.
Written for Java 25. Examples that show an output were run in the Zerethon sandbox (Java 25) on 2026-10-20.
Basics
-
Hello, World
A class with a
mainmethod, andSystem.out.println. -
Variables and types
Primitive types,
String,var, casting, and converting text to numbers. -
Conditions and loops
if/else,switchexpressions,for, the enhancedfor, andwhile. -
Methods, classes and records
Static methods, overloading, classes with fields and constructors, and
recordfor simple data.
Data
-
Arrays, lists and maps
Arrays,
ArrayList,HashMap,Set, sorting withArrays.sortandComparator. -
Strings and regular expressions
String methods,
String.format,StringBuilder, splitting, and regular expressions.
Input and files
-
Reading input (stdin)
Read what you type in the IDE's Input tab with
ScannerorBufferedReader. -
Reading and writing files
Read project files with
java.nio.file.Files; write temporary files under/tmp. -
Packages and several files
One public class per file, folders as packages, and
importbetween them.
In Zerethon IDE
-
Running Java in Zerethon IDE
How Run compiles your project with javac and starts the entry class, the time limit, input and tests.
-
Common errors
Compile errors such as “cannot find symbol” and “incompatible types”, and exceptions such as
NullPointerException. -
Official documentation
Where to read more: the Java SE 25 API docs, dev.java tutorials and the language specification.