Introduction to Java
# CHAPTER 1
Introduction to Java
1. Introduction
What if someone told you there's a programming language that runs on over 3 billion devices — from Android phones to banking systems, from Netflix's backend to NASA's Mars Rover software? That language is Java. Created in 1995, Java is one of the most enduring, versatile, and in-demand programming languages on the planet. In this chapter, we'll explore what Java is, why it was created, and why learning it in 2025 is still one of the smartest career moves you can make.2. Learning Objectives
By the end of this chapter, you will be able to:- Explain what Java is and its core philosophy.
- Describe the history and evolution of Java.
- List the key features that make Java unique.
- Differentiate between JVM, JRE, and JDK.
- Identify real-world applications built with Java.
3. What is Java?
Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. It follows the famous principle:> "Write Once, Run Anywhere" (WORA)
This means Java code, once compiled, can run on any device that has a Java Virtual Machine (JVM) — whether it's Windows, macOS, Linux, or Android.
Real-World Analogy: Think of Java like a universal power adapter. You write your code once (the adapter), and it works in every country (every operating system) without modification.
4. History of Java
Java was created by James Gosling and his team at Sun Microsystems in 1995. It was originally called "Oak" (named after an oak tree outside Gosling's office) and later renamed to Java — inspired by Java coffee from Indonesia.| Year | Milestone |
|---|---|
| 1991 | Project "Green" started at Sun Microsystems |
| 1995 | Java 1.0 officially released |
| 2006 | Java becomes open-source |
| 2010 | Oracle acquires Sun Microsystems |
| 2014 | Java 8 released (Lambdas, Streams) |
| 2017 | Java 9 (Modules) — 6-month release cycle begins |
| 2021 | Java 17 LTS released |
| 2023 | Java 21 LTS released |
5. Key Features of Java
Java's popularity stems from its powerful set of features:- 1. Platform Independent: Java code compiles to bytecode, which runs on any JVM.
- 2. Object-Oriented: Everything in Java revolves around objects and classes.
- 3. Simple: Java removed complex features like pointers and multiple inheritance of classes (from C++).
- 4. Secure: Java has no explicit pointers, runs inside a virtual machine sandbox, and includes a built-in security manager.
- 5. Robust: Strong memory management, automatic garbage collection, and exception handling.
- 6. Multithreaded: Java natively supports concurrent execution of two or more threads.
- 7. High Performance: Just-In-Time (JIT) compilation makes Java fast despite being interpreted.
- 8. Distributed: Java was designed for the distributed environment of the internet with built-in networking support.
6. Understanding JVM, JRE, and JDK
This is the #1 interview question for Java beginners:
- JVM (Java Virtual Machine): The engine that actually runs your Java bytecode. It's what makes Java platform-independent.
- JRE (Java Runtime Environment): JVM + the core libraries needed to run Java programs. If you only want to *run* Java apps, you need the JRE.
-
JDK (Java Development Kit): JRE + development tools like the compiler (
javac). If you want to *write* Java code, you need the JDK.
7. Why is Java So Popular?
- Enterprise Dominance: The majority of Fortune 500 companies use Java for backend systems.
- Android Development: Android's native development used Java for over a decade.
- Job Market: Java consistently ranks in the top 3 most in-demand programming languages globally.
- Massive Ecosystem: Frameworks like Spring Boot, Hibernate, and Apache Kafka power modern microservices.
- Community: Millions of developers, thousands of libraries, and decades of documentation.
8. Real-World Applications of Java
| Application | Description |
|---|---|
| Android Apps | WhatsApp, Spotify, and Twitter were built with Java |
| Banking Systems | Most ATM software runs on Java |
| E-commerce | Amazon's backend uses Java extensively |
| Big Data | Apache Hadoop, Spark, and Kafka are written in Java |
| Scientific Computing | NASA uses Java for mission-critical applications |
| Enterprise Software | SAP, Oracle ERP systems |
9. Mini Project: Welcome Message Application
Let's write our very first Java program conceptually (we'll set up the environment in Chapter 2):Expected Output:
10. Common Mistakes
- Confusing Java with JavaScript: Despite the similar names, Java and JavaScript are completely different languages. Java is a compiled, statically-typed language for backend/Android. JavaScript is an interpreted, dynamically-typed language for web browsers.
- Thinking Java is outdated: Java evolves every 6 months with modern features like records, sealed classes, and pattern matching.
11. Best Practices
- Start with the JDK, not just the JRE: As a developer, always install the full JDK.
- Use the latest LTS version: Java 17 or Java 21 LTS are recommended for production.
12. Exercises
- 1. List five real-world applications that use Java.
- 2. Explain the difference between JVM, JRE, and JDK in your own words.
- 3. Why is Java called "platform-independent"?
- 4. Who created Java, and what was it originally named?
13. MCQ Quiz with Answers
Who created the Java programming language?
What does JVM stand for?
What is the "Write Once, Run Anywhere" principle?
Which of the following is NOT a feature of Java?
What was Java originally called?
What do you need to install to DEVELOP Java applications?
Java is primarily what type of programming language?
Which company currently owns and maintains Java?
Java bytecode is executed by which component?
Which of these is a real-world Java application?
14. Interview Questions
- Q: What is the difference between JDK, JRE, and JVM?
- Q: Why is Java considered platform-independent?
- Q: Is Java a compiled or interpreted language? (Trick question — it's both!)
- Q: Name three features that make Java secure.
- Q: Why do enterprises prefer Java over other languages?
15. FAQs
Q: Is Java still worth learning in 2025? A: Absolutely. Java remains one of the top 3 most demanded languages in the job market, especially for backend, enterprise, Android, and Big Data roles.Q: Is Java hard to learn? A: Java has a moderate learning curve. Its strict syntax enforces good habits, making it an excellent first language for computer science students.