JAVA

Java is a high-level, object-oriented programming language developed by Sun Microsystems and now owned by Oracle. It is widely used for building scalable, secure, and platform-independent applications. Java follows the Write Once, Run Anywhere (WORA) principle, meaning compiled Java code can run on any platform without recompilation.

The first version of Java was JDK 1.0, and the latest versions are:

  • JDK 21 (LTS - Long Term Support)
  • JDK 23 (Non-LTS)

Applications Using Java

Many popular applications use Java as their backend, including:

  • eSewa (Nepal's leading payment gateway)
  • PayPal
  • Amazon
  • Alibaba
  • Uber

Key Features of Java

  • Platform Independent: Compiled Java code can run on any platform without recompilation.
  • Object-Oriented: Java follows OOP principles.
  • Automatic Garbage Management: Java has a garbage collector that automatically handles memory allocation and deallocation.
  • Security: Features like bytecode verification and the security manager help prevent unauthorized access.
  • Rich Standard Library: Java provides a vast set of built-in libraries and frameworks.

JDK (Java Development Kit) Components

  • Java Compiler: Converts Java source code into bytecode.
  • Java Virtual Machine (JVM): Executes Java bytecode.
  • Java Runtime Environment (JRE): Provides libraries and JVM to run Java applications.

Object-Oriented Programming (OOP) Principles

  1. Encapsulation: Wrapping data and methods within a class.
  2. Inheritance: Creating a new class from an existing class.
  3. Polymorphism: Allowing a single interface to represent different types.
  4. Abstraction: Hiding implementation details and exposing only necessary parts.

Commonly Used Java Libraries and Frameworks

  • Spring Boot: A framework for building enterprise applications.
  • Hibernate: An ORM framework for database interaction.
  • JavaFX: For building GUI applications.
  • Apache Kafka: A distributed event streaming platform.

Example Java Program

public class Main { 
    public static void main(String[] args) { 
        System.out.println("Hello, World"); // Output: Hello, World 
    } 
}