Module 1.1

Introduction to Java

Discover Java's history, platform independence, object-oriented principles, and why it powers billions of applications worldwide. Perfect for beginners starting their Java journey!

30 min read
Beginner
What You'll Learn
  • Java history and evolution
  • Platform independence and JVM
  • Object-oriented principles
  • Java architecture and ecosystem
  • Real-world Java applications
Contents
01

What is Java?

Java is a versatile, high-level, general-purpose programming language designed with simplicity and portability as core principles. It is one of the most popular languages in the world, used by millions of developers for everything from mobile applications to enterprise systems.

Java

A robust, object-oriented, compiled programming language that runs on the Java Virtual Machine (JVM), enabling code to run on any platform without modification - "Write Once, Run Anywhere" (WORA).

Java is known for its strong typing, automatic memory management, extensive libraries, and massive community support in both enterprise and open-source ecosystems.

The Java Motto: "Write Once, Run Anywhere" - Java code compiled once can run on Windows, Mac, Linux, mobile devices, and even IoT devices without recompilation!

Why Learn Java?

Java has consistently ranked among the top 3 most popular languages for over two decades. Here's why:

Reliability & Stability

Java's strict type checking, exception handling, and garbage collection make it one of the most reliable languages, ideal for mission-critical systems handling trillions in transactions daily.

Platform Independent

Thanks to the JVM, Java code runs identically on any operating system. This portability is unmatched - write once, compile once, run anywhere.

Rich Ecosystem

Maven, Gradle, Spring, Hibernate, and thousands of libraries make complex tasks manageable and development exponentially faster.

Massive Community

With millions of developers worldwide, finding solutions, libraries, and mentors is incredibly easy. The community is always ready to help.

02

Java History & Evolution

Java's journey from a niche language to the backbone of global enterprise systems is fascinating. Understanding its history helps appreciate the design decisions that make Java what it is today.

1991
The Beginning

James Gosling and his team at Sun Microsystems begin developing "Oak," a language designed for embedded devices and consumer electronics. The vision is to create a truly platform-independent language.

1995
Java is Born

Oak is renamed to Java and released publicly with the groundbreaking slogan "Write Once, Run Anywhere" (WORA). Version 1.0 is released with the HotJava browser plugin, revolutionizing web interactivity.

1998
J2SE 1.2 - Enterprise Ready

The Java 2 Platform, Standard Edition (J2SE) introduces the Swing GUI framework, collections framework, and just-in-time (JIT) compilation. Java becomes competitive for desktop applications and enterprise systems.

2004
Java SE 5.0 - Modern Features

Major improvements including generics, enums, annotations, autoboxing, and foreach loops make Java more expressive and developer-friendly. This release significantly modernizes the language.

2010
Oracle Acquires Sun

Oracle Corporation acquires Sun Microsystems, becoming the steward of Java. While there's initial controversy, Java's development continues and accelerates under Oracle's leadership.

2014
Java SE 8 - Functional Programming

Lambda expressions, the streams API, and functional programming support modernize Java. This release is pivotal in keeping Java relevant in the era of functional programming paradigms.

2021+
Modern Java Era - Six-Month Releases

Starting with a six-month release cycle, Java 17, 18, 19, 20, and 21 bring records, sealed classes, pattern matching, text blocks, virtual threads, and structured concurrency. Java remains cutting-edge and actively developed.

Current Status: Java 21 is the latest long-term support (LTS) version, released in September 2023 with multi-year support.
03

Platform Independence & JVM Magic

One of Java's greatest strengths is its platform independence. Unlike languages that compile to native machine code, Java compiles to bytecode that runs on the Java Virtual Machine. This abstraction layer is the secret to WORA.

How Java Achieves Platform Independence

Java's platform independence is achieved through a unique compilation and execution model. Here's how it works:

1

Write Java Code

You write your code in a .java file with standard Java syntax, regardless of the target platform (Windows, Mac, Linux).

Plain Text .java Files
2

Compile to Bytecode

The Java compiler (javac) converts your source code to platform-independent bytecode, not machine code. This produces .class files.

javac Compiler .class Files
3

JVM Interprets

Each platform (Windows, Linux, Mac) has its own JVM that understands bytecode and interprets/compiles it to native machine code at runtime (JIT compilation).

JVM JIT Compiler
4

Run Anywhere (WORA)

The same bytecode runs identically on any platform with a JVM installed. No recompilation needed! This is the essence of "Write Once, Run Anywhere."

Cross-Platform Execution - One bytecode, infinite platforms!
Key Difference: Languages like C/C++ compile directly to machine code (binary), which is platform-specific and must be recompiled for each platform. Java compiles to bytecode, which is interpreted by the platform-specific JVM, achieving true platform independence.
04

Object-Oriented Programming Fundamentals

Java is a pure object-oriented language (except for primitive types). Understanding OOP principles is essential to writing good Java code. The four pillars of OOP are encapsulation, abstraction, inheritance, and polymorphism.

Encapsulation

Bundling data (variables) and methods together within a class, hiding internal details from the outside world.

private int age;
public void setAge(int a) { 
  if(a > 0) age = a; 
}
Abstraction

Hiding complex implementation details and showing only essential features through interfaces and abstract classes.

abstract class Shape {
  abstract void draw();
}
Inheritance

Creating a hierarchy where a subclass inherits properties and methods from a parent class, promoting code reuse.

class Dog extends Animal {
  // inherits all methods from Animal
}
Polymorphism

Objects can take multiple forms. Methods with the same name can behave differently in different contexts (overloading/overriding).

// Method overloading
void print(int x) { }
void print(String x) { }
05

The Java Ecosystem & Community

Java's true power lies not just in the language, but in its expansive ecosystem of tools, frameworks, and libraries developed by millions of developers over 30 years. Here's an overview of the major components:

Core Libraries (JDK/JRE)

Collections, I/O, networking, concurrency utilities, and standard algorithms built into every Java installation

Web Frameworks

Spring, Spring Boot, Jakarta EE, Quarkus for building web applications, REST APIs, and microservices

ORM & Data Access

Hibernate, JPA, MyBatis for efficient database interaction without writing raw SQL

Build Tools

Maven and Gradle for dependency management, compilation, and project lifecycle management

Testing Frameworks

JUnit 5, Mockito, TestNG for unit testing and test-driven development

Cloud & DevOps

Docker support, Kubernetes orchestration, AWS/Azure SDKs, and cloud-native frameworks

06

Real-World Java Applications

Java powers countless applications you use daily. From the smallest Android app to the largest financial trading systems, Java's reliability makes it the go-to language for critical systems worldwide:

Android Apps

Billions of Android apps are written in Java (and Kotlin, which runs on JVM). Nearly 4 billion Android devices worldwide use Java

Enterprise Systems

Banks, insurance companies, and large corporations rely on Java for mission-critical systems handling trillions in transactions daily

Web Applications

Major platforms like LinkedIn, Twitter, Airbnb, and Netflix use Java for their backend infrastructure and microservices

Game Development

Minecraft, one of the most popular games ever, is written in Java. Many game engines support Java development

Big Data & ML

Apache Spark, Hadoop, and Kafka - the backbone of big data processing - are built with Java

IoT & Embedded

Java runs on IoT devices, smart home systems, and embedded devices thanks to its portability and efficiency

By the Numbers: Over 15 billion devices run Java, making it one of the most widespread runtime environments on the planet!

Key Takeaways

Platform Independence

Java's WORA principle through bytecode and JVM allows code to run identically on any platform

Object-Oriented Design

Java enforces OOP principles, making code organized, reusable, and maintainable at scale

Massive Ecosystem

Thousands of libraries and frameworks handle virtually any programming need imaginable

Reliability & Safety

Strong typing, exception handling, and garbage collection prevent common programming errors

Enterprise-Grade Performance

JVM optimizations like JIT compilation make Java fast enough for high-performance systems

Community Support

Millions of developers mean abundant resources, libraries, and solutions to any problem

Knowledge Check

Test your understanding of Java fundamentals:

Question 1 of 6

What does WORA stand for in the context of Java?

Question 2 of 6

What is the Java Virtual Machine (JVM) primarily responsible for?

Question 3 of 6

Java was originally created to target which type of devices?

Question 4 of 6

Which of the following is NOT one of the four pillars of Object-Oriented Programming?

Question 5 of 6

What makes Java a "platform-independent" language?

Question 6 of 6

Which major technology was NOT built with Java?

Answer all questions to check your score