☕ Java

What is Java?

Java is a high-level, object-oriented programming language built on one killer idea: write your code once, and run it on any device — Windows, Mac, Linux, phone, smartwatch, you name it. No rewrites needed.

Overview of Java

Java was created by James Gosling at Sun Microsystems in 1995 with one ambitious goal: build a language that works everywhere. That idea became the famous motto — "Write Once, Run Anywhere" (WORA). Think about it this way: when you install WhatsApp on your phone, it doesn't matter if you have a Samsung, OnePlus, or an old Nokia — it runs. That's the same philosophy Java was built on, just applied to the backend world. Today, Java powers some of the most critical systems on Earth: • Your bank's transaction system? Probably Java. • Netflix, LinkedIn, Amazon's backend? Heavy Java. • Most Android apps under the hood? Java or Kotlin (which runs on the Java ecosystem). • The backend of government portals and insurance systems? Java, almost certainly. Java isn't just popular — it's been in the top 3 programming languages for over 25 years. That says something.

A Brief History of Java

• 1991 — James Gosling starts the "Oak" project at Sun Microsystems (meant for smart TVs, ironically) • 1995 — Renamed to Java and released publicly. The internet was just taking off — perfect timing. • 2006 — Sun open-sourced Java under the GPL license. The community exploded. • 2010 — Oracle acquired Sun Microsystems (and with it, Java) • 2014 — Java 8 dropped. Lambdas, Streams, the Optional class — this was a full-on revolution. • 2021 — Java 17 LTS (Long-Term Support) released • 2023 — Java 21 LTS released — the version most serious projects are moving to right now

Your First Java Program

Every Java program needs two things: a class and a main method. The main method is the entry point — Java starts reading your code from here. Think of it as the "front door" of your program.
Java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

How Java Actually Works (Under the Hood)

Here's something that trips up beginners: Java is neither fully compiled (like C++) nor fully interpreted (like Python). It's both. Step 1: You write code in a .java file. Step 2: The Java Compiler (javac) converts it to bytecode — a .class file. This bytecode isn't machine code; it's instructions for the JVM. Step 3: The JVM (Java Virtual Machine) on your specific OS reads that bytecode and runs it. This is why Java is platform-independent. The bytecode is the same everywhere — only the JVM differs per OS, and Oracle/the community provides JVMs for all major platforms. Real-life analogy: Think of bytecode as a universal recipe written in a standard format. Different chefs (JVMs) follow the same recipe in their own kitchen (OS) and produce the same dish (output).