Skip to main content

Java Introduction

What is Java?

Java is a high-level, class-based, object-oriented programming language designed to be portable, secure, and maintainable for long-term software development.

It follows the principle:

Write Once, Run Anywhere (WORA)

Java code is compiled into bytecode, which runs on the Java Virtual Machine (JVM) — making it platform-independent.

Key Characteristics

  • Platform independent: Java code compiles into bytecode that runs on the JVM, so the same program can run on Windows, Linux, or macOS.
  • Strongly typed + OOP-friendly: Encourages clear structure (classes, interfaces) and safer refactoring.
  • Rich ecosystem: Mature standard library + huge community + frameworks (e.g., Spring) and build tools (Maven/Gradle).
  • Performance: The JVM uses JIT compilation to optimize frequently executed code paths.

Quick Facts

  • Developed by Sun Microsystems (1995) (now Oracle)
  • Syntax inspired by C/C++, but safer
  • Widely used in:
    • Backend development
    • Android apps
    • Enterprise systems
    • Cloud & distributed systems

Why We Need Java?

Java became popular because it solves major problems developers faced earlier:

Reasons to Use Java

  1. Platform Independence No need to rewrite code for different systems
  2. Stability & Reliability Used in banking, enterprise, and critical systems
  3. Security Built-in features like bytecode verification and sandboxing
  4. Large Ecosystem Frameworks like Spring, Hibernate
  5. Scalability Handles large applications easily
  6. Job Opportunities Huge demand in backend and enterprise development

History of Java

Java was created by James Gosling and his team at Sun Microsystems.

Timeline

  • 1991 → Project started (called Oak)
  • 1995 → Renamed to Java and officially released
  • 1996 → First public version (JDK 1.0)
  • 2009 → Oracle acquired Sun Microsystems
  • 2014 → Java 8 (most popular release)
  • 2021+ → Modern LTS versions (Java 17, 21)

Why Learn Java?

  1. Widely Used and In-Demand Java is used by millions of developers and powers everything from enterprise applications to Android apps and web services. Top companies like Google, Netflix, and Amazon rely on it.

  2. Beginner-Friendly, Yet Powerful Java has a clean, readable syntax and a vast ecosystem of tools and libraries. It’s great for beginners but also scales well for advanced projects.

  3. Write Once, Run Anywhere Java is platform-independent. You write code once and run it on any system with a Java Virtual Machine (JVM).

  4. Robust and Secure With strong memory management, type safety, and built-in security features, Java is ideal for building reliable and secure applications.

  5. Career and Job Opportunities Java developers are always in demand — especially in backend development, enterprise systems, and Android app development.

  6. Strong Foundation for Other Tech Learning Java helps you understand key concepts like OOP (Object-Oriented Programming), multithreading, and data structures — which are useful in many other languages too.

Types of Java Applications

Java is used to build different types of applications:

  1. Web Applications: Backend APIs using frameworks like Spring Boot Example: E-commerce websites
  2. Mobile Applications: Android apps (Java/Kotlin)
  3. Enterprise Applications: Banking systems, ERP, CRM Highly scalable and secure
  4. Cloud-Based Applications: Microservices and distributed systems
  5. Big Data Applications: Tools like Hadoop, Spark run on JVM
  6. Desktop Applications: GUI apps using JavaFX, Swing

Java Versions History

VersionRelease DateKey Features / Notes
JDK 1.0January 1996Initial release — basic core API and JVM
JDK 1.1February 1997Inner classes, JDBC, RMI, JavaBeans
J2SE 1.2December 1998Collections framework, Swing, JIT compiler
J2SE 1.3May 2000HotSpot JVM, RMI over IIOP
J2SE 1.4February 2002assert keyword, NIO, logging API, XML parsing
Java SE 5September 2004Generics, enhanced for-loop, annotations, enums, autoboxing
Java SE 6December 2006Scripting engine (JS), improvements in Web Services, JVM monitoring
Java SE 7July 2011try-with-resources, NIO.2, Diamond operator
Java SE 8March 2014Lambda expressions, Streams API, Optional, Date/Time API
Java SE 9September 2017JPMS (modules), JShell, improved JDK structure
Java SE 10March 2018var for local variable type inference
Java SE 11September 2018LTS version, removed JavaFX, HTTP Client API
Java SE 12March 2019Switch expressions (preview)
Java SE 13September 2019Text blocks (preview), dynamic CDS
Java SE 14March 2020Records (preview), instanceof pattern matching (preview)
Java SE 15September 2020Sealed classes (preview), hidden classes
Java SE 16March 2021Records and pattern matching (finalized), new memory APIs
Java SE 17September 2021LTS version, sealed classes, pattern matching
Java SE 18March 2022Simple web server, UTF-8 by default
Java SE 19September 2022Virtual threads (preview), structured concurrency (preview)
Java SE 20March 2023Continued virtual threads and pattern matching enhancements
Java SE 21September 2023LTS version, virtual threads, string templates, sequenced collections
Java SE 22March 2024Unnamed classes, class-file API improvements (preview)

Java Program Structure

Here’s a simple Hello World program:

publicclassHelloWorld {
publicstaticvoidmain(String[]args) {
System.out.println("Hello, World!");
}
}

Explanation

  • class HelloWorld → Defines a class
  • main() method → Entry point of the program
  • System.out.println() → Prints output

Execution Flow

  1. Write code → .java file
  2. Compile → Bytecode (.class)
  3. Run using JVM