Introduction to Core Java
Java remains a foundational pillar of enterprise application development, Android engineering, and scalable distributed systems.
1. The Core Pillars of Object-Oriented Programming (OOP)
Java is fundamentally built upon Object-Oriented Programming models designed to mirror real-world entities through programmatic structures. To build maintainable, decoupled systems, a deep internalization of the four core pillars is required:
- Class & Object: A Class acts as a stateless blueprint or template defining variables and methods. An Object is a concrete instance generated from that class, holding unique state configurations and executing explicit behaviors in memory.
- Encapsulation: The practice of wrapping data (fields) and code (methods) into a single operational unit. By applying access modifiers (
private,protected,public), you selectively hide internal object details, protecting object states from arbitrary external corruption. - Inheritance: An structural mechanism allowing a child class (subclass) to inherit fields and methods from a parent class (superclass), facilitating code reuse and establishing polymorphic hierarchies.
- Polymorphism: The capacity of an interface, message, or function to manifest in multiple forms. Java achieves this through compile-time polymorphism (Method Overloading) and runtime polymorphism (Method Overriding).
2. The Java Compilation and Execution Pipeline
One of Java’s defining engineering traits is its hardware-agnostic design, summarized by the architectural principle: “Write Once, Run Anywhere” (WORA). Achieving this requires a two-step translation process that explicitly divides compile time and runtime.
Get Priyanka Hajare’s stories in your inbox
Join Medium for free to get updates from this writer.
Compile Time
When you author a Java source file (e.g., Hello.java), the raw source code must be translated into something machine-neutral:
- The Java Compiler (
javac) ingests your.javasource file. - If syntax errors exist, compilation halts.
- Upon error-free execution,
javacoutputs a standardized, universal bytecode stored inside a.classfile.
Runtime (Inside the Java Virtual Machine)
The generated bytecode cannot execute directly on target CPU registers; it requires interpretation and orchestration via the Java Virtual Machine (JVM).
- Class Loader: Dynamically loads the necessary
.classfiles into the JVM memory spaces when their definitions are needed during execution. - Bytecode Verifier: An essential security sandbox mechanism that inspects the loaded bytecode to verify it does not violate memory access rules, stack constraints, or compromise host system stability.
- Execution Engine: The engine utilizes an Interpreter to read and execute bytecode line-by-line. However, to eliminate the speed penalties of ongoing interpretation, a Just-In-Time (JIT) Compiler analyzes execution hot-spots and compiles frequently executed bytecode segments directly into native machine code targeting the local Operating System and Hardware.








