Skip to main content
Java Basics
CHAPTER 01 Beginner

Introduction to Java

Updated: Aug 1, 2026
5 min read

# CHAPTER 1

Introduction to Java

"Write once, run anywhere" was Sun Microsystems' promise for Java in 1995, and it is worth unpacking, because the mechanism behind that slogan explains most of the language's design.

A C program compiles to machine code for one specific processor and operating system; move it elsewhere and it must be recompiled. Java compiles instead to *bytecode*, an intermediate instruction set that no physical processor executes. A Java Virtual Machine on the target machine reads that bytecode and translates it to whatever the local hardware understands. Write the program once, and any machine with a JVM can run the identical compiled artefact.

That indirection cost Java some raw speed, bought back over the years by just-in-time compilation. What it purchased was portability, and portability is why Java became the default in places where software outlives hardware: banking systems, insurance platforms, telecoms, and the whole Android ecosystem. A large share of the enterprise systems quietly running the world are Java, and they are not being rewritten.

The language is also deliberately verbose. Java asks you to declare types, handle exceptions explicitly, and state your intentions in full. That is tedious on a small script and genuinely valuable on a two-million-line codebase maintained by two hundred people over fifteen years — which is the situation Java was designed for.

This chapter gets the JDK installed and the toolchain understood before any syntax, since "it compiles here but not there" is the single most common beginner obstacle.

1. 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.

2. 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.
YearMilestone
1991Project "Green" started at Sun Microsystems
1995Java 1.0 officially released
2006Java becomes open-source
2010Oracle acquires Sun Microsystems
2014Java 8 released (Lambdas, Streams)
2017Java 9 (Modules) — 6-month release cycle begins
2021Java 17 LTS released
2023Java 21 LTS released

3. Key Features of Java

Java's popularity stems from its powerful set of features:
  1. 1. Platform Independent: Java code compiles to bytecode, which runs on any JVM.
  1. 2. Object-Oriented: Everything in Java revolves around objects and classes.
  1. 3. Simple: Java removed complex features like pointers and multiple inheritance of classes (from C++).
  1. 4. Secure: Java has no explicit pointers, runs inside a virtual machine sandbox, and includes a built-in security manager.
  1. 5. Robust: Strong memory management, automatic garbage collection, and exception handling.
  1. 6. Multithreaded: Java natively supports concurrent execution of two or more threads.
  1. 7. High Performance: Just-In-Time (JIT) compilation makes Java fast despite being interpreted.
  1. 8. Distributed: Java was designed for the distributed environment of the internet with built-in networking support.

4. Understanding JVM, JRE, and JDK

This is the #1 interview question for Java beginners:

12345678910111213141516171819
+-----------------------------------------------+
|                    JDK                        |
|  (Java Development Kit)                       |
|                                               |
|   +---------------------------------------+   |
|   |              JRE                      |   |
|   |  (Java Runtime Environment)           |   |
|   |                                       |   |
|   |   +-------------------------------+   |   |
|   |   |           JVM                 |   |   |
|   |   |  (Java Virtual Machine)       |   |   |
|   |   |  - Executes bytecode          |   |   |
|   |   +-------------------------------+   |   |
|   |                                       |   |
|   |   + Class Libraries                   |   |
|   +---------------------------------------+   |
|                                               |
|   + Development Tools (javac, jar, etc.)      |
+-----------------------------------------------+
  • 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.
  • 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.

6. Real-World Applications of Java

ApplicationDescription
Android AppsWhatsApp, Spotify, and Twitter were built with Java
Banking SystemsMost ATM software runs on Java
E-commerceAmazon's backend uses Java extensively
Big DataApache Hadoop, Spark, and Kafka are written in Java
Scientific ComputingNASA uses Java for mission-critical applications
Enterprise SoftwareSAP, Oracle ERP systems

7. Mini Project: Welcome Message Application

Let's write our very first Java program conceptually (we'll set up the environment in Chapter 2):
java
1234567
public class Welcome {
    public static void main(String[] args) {
        System.out.println("Welcome to the World of Java!");
        System.out.println("Java powers over 3 billion devices worldwide.");
        System.out.println("Let's begin our journey!");
    }
}

Expected Output:

123
Welcome to the World of Java!
Java powers over 3 billion devices worldwide.
Let's begin our journey!

8. 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.

9. 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.

10. Exercises

  1. 1. List five real-world applications that use Java.
  1. 2. Explain the difference between JVM, JRE, and JDK in your own words.
  1. 3. Why is Java called "platform-independent"?
  1. 4. Who created Java, and what was it originally named?

11. MCQ Quiz with Answers

Question 1

Who created the Java programming language?

Question 2

What does JVM stand for?

Question 3

What is the "Write Once, Run Anywhere" principle?

Question 4

Which of the following is NOT a feature of Java?

Question 5

What was Java originally called?

Question 6

What do you need to install to DEVELOP Java applications?

Question 7

Java is primarily what type of programming language?

Question 8

Which company currently owns and maintains Java?

Question 9

Java bytecode is executed by which component?

Question 10

Which of these is a real-world Java application?

12. 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?

13. 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.

14. Summary

Java is a high-level, object-oriented, platform-independent language created by James Gosling in 1995. Its "Write Once, Run Anywhere" philosophy, powered by the JVM, makes it one of the most versatile languages ever created. The JDK is your toolkit for writing Java, the JRE runs it, and the JVM is the engine underneath. With billions of devices running Java and a massive job market, learning Java is a powerful investment in your career.

15. Next Chapter Recommendation

Now that you understand *what* Java is and *why* it matters, it's time to get your hands dirty. In Chapter 2: Installing Java and Setting Up Environment, we will install the JDK, configure environment variables, set up an IDE (IntelliJ IDEA or Eclipse), and write your first program from scratch.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·