What is Java?
Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. Created by James Gosling at Sun Microsystems and released in 1995, it remains one of the most widely used languages in the world — powering banking systems, Android apps, big-data pipelines, and a vast share of enterprise backends.
Its defining promise is “Write Once, Run Anywhere” (WORA): you compile Java source into platform-neutral bytecode, and any device with a Java Virtual Machine (JVM) can run it without recompilation.
Why Java is still everywhere
Three decades in, Java is far from legacy. It thrives because of a rare combination of properties:
- Portability. Bytecode runs on any JVM — Windows, macOS, Linux, mainframes.
- Performance. The JVM’s Just-In-Time (JIT) compiler optimizes hot code paths to near-native speed at runtime.
- A massive ecosystem. Spring, Hibernate, Kafka, Elasticsearch, and millions of libraries on Maven Central.
- Backward compatibility. Code written years ago typically still compiles and runs, which enterprises depend on.
- Strong typing & tooling. Compile-time checks and world-class IDEs catch errors early.
How Java runs your code
The journey from source to execution has three clear steps:
Hello.java ──javac──▶ Hello.class ──JVM──▶ running program
(source) (bytecode) (machine instructions)
- You write source code in a
.javafile. - The compiler (
javac) translates it into bytecode (.class). - The JVM loads that bytecode, verifies it, and the JIT compiler turns the hot paths into native machine code as the program runs.
Your first program
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, DevCraftly!");
}
}
Compile and run it:
javac Hello.java # produces Hello.class
java Hello # prints: Hello, DevCraftly!
Output:
Hello, DevCraftly!
A quick history
| Year | Milestone |
|---|---|
| 1995 | Java 1.0 released by Sun Microsystems |
| 2004 | Java 5 — generics, annotations, enums |
| 2014 | Java 8 — lambdas & the Streams API |
| 2017 | Java 9 — the module system |
| 2021 | Java 17 — a major Long-Term Support (LTS) release |
| 2023 | Java 21 — virtual threads (Project Loom) |
What you’ll learn in these docs
This documentation walks you from the absolute basics to advanced, interview-grade topics:
- Fundamentals — syntax, variables, data types, control flow.
- Object-oriented programming — classes, inheritance, polymorphism.
- Collections & Streams — the data structures you’ll use daily.
- Concurrency — threads, executors, and modern virtual threads.
- Modern Java — the best features from Java 8, 11, 17, and 21.
Note: You don’t need any prior Java experience. If you understand basic programming concepts, you’re ready to start.
Best practices to internalize early
- Prefer clear names over clever ones —
customerCount, notcc. - Keep classes small and focused (Single Responsibility Principle).
- Favor immutability where practical; it eliminates whole classes of bugs.
- Learn to read stack traces — they tell you exactly where things failed.
Interview questions
Q: Is Java compiled or interpreted?
Both. Source is compiled to bytecode by javac, then the JVM interprets and
JIT-compiles that bytecode to native code at runtime.
Q: What does “platform independent” mean for Java?
The compiled bytecode is independent of the underlying OS/hardware. Only the JVM
is platform-specific — so the same .class file runs anywhere a JVM exists.
Q: Is Java fully object-oriented?
Almost. It’s object-oriented but not “pure” because it has primitive types
(int, boolean, etc.) that are not objects.