This repository contains my personal study notes on Java. It covers the history, features, and the core architecture of the Java platform.
Java is a high-level, robust, and object-oriented programming language developed by James Gosling at Sun Microsystems in 1995.
- Historical Note: It was originally named Oak (after an oak tree outside Gosling's office), but later renamed to Java.
- Core Philosophy: "Write Once, Run Anywhere" (WORA).
| Feature | Description |
|---|---|
| Simple | Syntax is clean and based on C / C++, but without complex features like pointers. |
| OOPs (Object-Oriented Programming) | Everything in Java is an Object. It follows concepts like Inheritance, Polymorphism, Abstraction, and Encapsulation. |
| Platform Independent | Unlike many other languages, Java is compiled into platform-neutral bytecode. "Write Once, Run Anywhere." |
| Secure | Runs in a sandbox environment; no explicit pointers prevent unauthorized memory access. |
| Robust | Strong memory management, lack of pointers, automatic Garbage Collection, and Exception Handling. |
| Architecture Neutral | Primitive data types have a fixed size regardless of the architecture (e.g., int is always 4 bytes in both 32-bit and 64-bit systems). |
| Multi-threaded | Supports the execution of two or more parts of a program concurrently to maximize CPU utilization. |
To understand how Java works, you have to understand the "Russian Doll" relationship between these three components:
- What it is: An abstract machine/runtime environment.
- Role: It loads, verifies, and executes the bytecode. It is platform-dependent (different versions for Windows, Mac, Linux), but it makes the code platform-independent.
- Formula:
JRE = JVM + Libraries (rt.jar) - Role: It provides the minimum requirements to run a Java application. It does not contain development tools like compilers.
- Formula:
JDK = JRE + Development Tools - Role: This is the full package needed to develop and run Java programs.
- Tools included: *
javac: The compiler (converts.javato.class).jar: Archiver for packaging libraries.jdb: The debugger.
Java is a statically-typed language, meaning all variables must be declared before they can be used.
- Source Code: You write code in a
.javafile. - Compilation: The JDK uses
javacto turn that code into Bytecode (.classfile). - Execution: The JVM (inside the JRE) interprets that bytecode so the computer can understand it.

