Getting Started

Java Introduction

Learn what Java is, its key features, and why it remains one of the most used languages in the world.

What is Java?

Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. Java programs are compiled to bytecode that runs on the Java Virtual Machine (JVM), making Java platform-independent.

> "Write once, run anywhere" — the Java motto

Key Features

  • Object-Oriented: Everything is an object (except primitives)
  • Platform Independent: JVM runs on Windows, macOS, Linux
  • Strongly Typed: Types must be declared explicitly
  • Garbage Collected: Automatic memory management
  • Robust: Strongly typed with compile-time and runtime checks
  • Multithreaded: Built-in support for concurrent programming

Where Java is Used

  • Enterprise backend systems
  • Android app development
  • Big data (Hadoop, Spark)
  • Financial systems
  • Web servers and APIs

Example

java
// Java program structure:
// 1. Every Java file must have a class matching the filename
// 2. The main method is the entry point
// 3. All code lives inside a class

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

        // Variables
        int age = 25;
        double price = 19.99;
        String name = "Java";
        boolean isActive = true;
        char grade = 'A';

        // Print to console
        System.out.println("Name: " + name);
        System.out.println("Age: " + age);
        System.out.printf("Price: %.2f%n", price);
        System.out.println("Active: " + isActive);
        System.out.println("Grade: " + grade);
    }
}
Try it yourself — JAVA