Ch 1.1 Java Overview
Target Version: Java 17 / 21 (LTS) Official Documentation: Oracle Java Documentation
Java is an object-oriented programming language released by Sun Microsystems in 1995. Now managed by Oracle, it is used in a wide range of fields inclusive of enterprise servers, Android apps, and big data systems.
1. What is Java?
Java was designed with the philosophy "Write Once, Run Anywhere." This is possible because Java bytecode runs on the JVM (Java Virtual Machine) rather than directly on specific hardware.
2. History of Java
- 1991: James Gosling and his team started the 'Oak' project, originally intended for consumer electronics.
- 1995: Officially released under the name 'Java'. It gained explosive popularity through its ability to run in web browsers (Applets).
- 2010: Oracle acquired Sun Microsystems.
- Present: New versions are released every six months, rapidly incorporating modern language features.
3. Features of Java
- Object-Oriented (OOP): Everything is treated as an object, providing excellent reusability and maintainability.
- Platform Independence: Ensures identical execution results across Windows, Linux, and macOS, provided a JVM is present.
- Automatic Memory Management (Garbage Collection): The system automatically handles memory cleanup, so developers don't have to manually free memory.
- Multi-threading Support: Simplifies the process of writing programs that can handle multiple tasks simultaneously.
- Rich Standard Library: A massive ecosystem of standard libraries and open-source projects is available.
4. JVM (Java Virtual Machine)
The JVM is a virtual machine that executes Java applications.
- Role: It translates Java bytecode into the machine code of the specific operating system for execution.
- Advantage: It provides the independence that allows Java to be decoupled from the underlying OS.
- Performance: While there was historically a slight performance overhead compared to native languages (like C/C++), modern JIT (Just-In-Time) compiler technology has largely closed that gap.
note
Java is highly regarded for its excellent balance between performance, stability, and developer productivity.