How this Java track works
- Compiled Java in the playground — write a
public class Mainwithpublic static void main(String[] args); the dev runner runsjavacthenjava. UseSystem.out.printlnfor output. - Class name must match the file — the public class name equals the filename (
Main.java). Fix compile errors from stderr before re-running. - Prerequisites — finish JavaScript (functions, objects) and PHP (OOP basics) for comparison. Java is strongly typed and class-centric from the start.
JDBC, Maven, and Spring lessons use conceptual prose plus println mock data—real projects need a local JDK, database, and build tool.
Install on your device (macOS, Linux, Windows)
Install JDK 17 or 21 to compile and run Java locally; playground uses javac/java on the runner.
macOS
brew install openjdk@21- Follow Homebrew caveats to add JDK to PATH (
/opt/homebrew/opt/openjdk@21/bin).
Linux
- Debian/Ubuntu:
sudo apt install -y openjdk-21-jdk - Fedora:
sudo dnf install -y java-21-openjdk-devel
Windows
winget install Microsoft.OpenJDK.21or Oracle/Temurin installer from adoptium.net.
Verify: java -version and javac -version succeed.
Run code on this site (Backend & language playgrounds)
- Clone or open this project locally; copy
.env.exampleto.env. - Ensure
LEARNING_RUNNER_ENABLED=trueandLEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute. - Terminal 1:
php artisan serve(orcomposer run devfor Laravel + Vite + runner together). - Terminal 2:
npm run runner— keep it running while you click Run on server.
Java is a statically typed, object-oriented language that runs on the Java Virtual Machine (JVM). The same bytecode can run on Linux servers, Windows laptops, and cloud containers—"write once, run anywhere" means compile to bytecode, then ship a JRE or container image.
How this track differs from JavaScript and PHP
After the JavaScript track, you know functions and objects in a dynamically typed browser runtime. After PHP, you have seen classes and server-side logic. Java is strongly typed from the first line: every variable has a declared type, and the compiler catches many mistakes before you run anything.
Java is not a scripting language you paste into HTML—it is compiled (javac) then executed (java). Enterprise APIs, Android backends (often Kotlin today), and batch jobs still lean heavily on Java patterns.
What you will learn
- Core syntax: classes,
main, types, control flow, and methods - OOP: encapsulation, inheritance, polymorphism, and interfaces
- Collections: arrays,
ArrayList,HashMap, generics basics - Exceptions, packages, I/O, and modern features (streams,
Optional, records) - Conceptual JDBC, Maven/Gradle, and a Spring teaser for interview context
Playground setup
This topic uses the server_compiled profile: your code compiles and runs on the dev runner. Use public class Main with public static void main(String[] args) and System.out.println for output. The public class name must match the filename (Main.java).
Self-check
- In one sentence, what executes Java bytecode?
- Why do we recommend JavaScript and PHP before this track?
Interview prep
- What is Java in one sentence?
A statically typed, object-oriented language that compiles to JVM bytecode—run anywhere a Java runtime is installed, with strong enterprise and Spring ecosystem support.