Java has been around since 1995, but modern Java (17+) is nothing like the Java your textbook taught you. It's faster, cleaner, and actually enjoyable to write.
This series covers every topic on dev.java/learn — one bite at a time. No fluff. Just what you need to know.
What You Need
Before writing code, you need two things:
1. JDK (Java Development Kit)
Download from adoptium.net — pick the latest LTS version (Java 21 or 24). Think of JDK as your Java toolbox — it has everything: compiler, runtime, and useful tools.
2. A text editor or IDE
For now, any text editor works. Later we'll set up VS Code or IntelliJ.
Your First Program
Create a file called Hello.java:
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, Modern Java!");
}
}
Breaking it down like a recipe:
-
public class Hello— A container called "Hello" (like a box with a label) -
public static void main(String[] args)— The entry point (the "start cooking" button) -
System.out.println(...)— Print text to screen (likeconsole.login JavaScript)
Run It
Open terminal, navigate to the file, and type:
javac Hello.java # Compile: turns .java into .class (like translating a recipe into action)
java Hello # Run: actually executes the translated code
Output:
Hello, Modern Java!
That's it. You just wrote and ran a Java program.
What Actually Happened?
Hello.java → javac → Hello.class → java → Output
(source) (compiler) (bytecode) (JVM) (result)
Analogy: You write a recipe in English (.java). The compiler translates it into a universal language (.class bytecode). The JVM (Java Virtual Machine) reads that universal language and actually cooks the dish — on Windows, Mac, or Linux.
This "compile once, run anywhere" is Java's superpower.
What's Changed in Modern Java?
If you learned Java 8 years ago, here's what's new:
| Old Java (8) | Modern Java (17+) |
|---|---|
public static void main(String[] args) |
void main() ✅ (yes, really!) |
| Verbose boilerplate everywhere | Records, var, pattern matching |
| Slow startup | Virtual Threads, CDS |
| Download Oracle JDK | Use OpenJDK (Adoptium, Temurin) |
Modern Java lets you write:
void main() {
System.out.println("No class wrapper needed!");
}
This is called an implicitly declared class — Java 21+. No public class, no public static void main(String[] args). Just your code.
JShell — Java's Scratchpad
Instead of creating files for every experiment, use JShell — Java's interactive REPL:
jshell
jshell> 2 + 2
$1 ==> 4
jshell> "Hello".toUpperCase()
$2 ==> "HELLO"
jshell> /exit
Think of JShell as a calculator for Java. Type code, see results instantly. Perfect for testing ideas without creating files.
Key Takeaways
- JDK = compiler + runtime + tools — download from Adoptium
-
Compile & Run =
javacthenjava - JVM = the magic that runs Java on any OS
- Modern Java = less boilerplate, more productivity
- JShell = your instant feedback playground
What's Next?
In Part 2, we'll set up VS Code and IntelliJ — your development environments. The right tools make everything easier.
This series follows dev.java/learn — the official Java learning path. Each article covers one topic, explained simply.






















