SyntaxStudy
Sign Up
Java Introduction to Java
Java Beginner 8 min read

Introduction to Java

Java is a class-based, object-oriented programming language designed to be portable — "write once, run anywhere." Java code is compiled to bytecode that runs on the Java Virtual Machine (JVM), which is available on virtually every platform.

Java is widely used for Android development, enterprise applications, backend services, and big data systems.

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

        // Variables and types
        int age = 25;
        double price = 19.99;
        String name = "Alice";
        boolean isActive = true;

        // String formatting
        System.out.printf("Name: %s, Age: %d%n", name, age);

        // Conditional
        if (age >= 18) {
            System.out.println(name + " is an adult.");
        } else {
            System.out.println(name + " is a minor.");
        }

        // Loop
        for (int i = 1; i <= 5; i++) {
            System.out.println("Count: " + i);
        }
    }
}