The Wayback Machine - https://web.archive.org/web/20261115230720/https://www.geeksforgeeks.org/java/introduction-to-java/

Introduction to Java

Last Updated : 4 Nov, 2026

Java is a high-level, class-based, object-oriented programming language developed by Sun Microsystems in 1995 and now maintained by Oracle.

  • Java source code is compiled into bytecode, which is executed by the Java Virtual Machine (JVM).
  • Java is a general-purpose language used for developing applications of different types.

Features of Java

Java provides several features that make it suitable for developing reliable, portable, and scalable applications.

features_of_java
Features of Java
  • Object-Oriented: Supports classes, objects, inheritance, encapsulation, polymorphism, and abstraction.
  • Platform Independent: Java bytecode runs on different operating systems with a compatible JVM.
  • Robust: Provides strong type checking and exception handling to improve reliability.
  • Secure: Includes bytecode verification and built-in security APIs.
  • Multithreading: Supports the concurrent execution of multiple tasks.
  • Rich Standard Library: Provides APIs for collections, file handling, networking, and database connectivity.
  • Automatic Memory Management: Uses garbage collection to reclaim memory occupied by unreachable objects.
  • High Performance: Uses Just-In-Time (JIT) compilation to optimize program execution.

Understanding Hello World Program

A Hello World program introduces basic Java syntax and helps beginners understand how a Java program works.

Traditional Hello World Program

This is the standard approach used in Java and works in all Java versions.

Java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

Output
Hello World!

Simplified Hello World Program (Java 24+)

Java 25 allows developers to write simple programs without explicitly declaring a class or using the traditional public static void main(String[] args) method.

Java
class Geeks{
    void main() {
        System.out.println("Hello, World!");
    }
}

Output
Hello, World!

This simplified syntax reduces boilerplate code and makes it easier for beginners to write their first Java programs.

Note: In Java 24, simple source files and instance main methods were preview features and required preview features to be enabled. The feature was finalized in Java 25.

To compile and execute these programs, follow our How to Run a Java Program

Structure of a Java Program

The structure of a Java program defines the standard format for writing Java applications and includes essential components required for program execution.

Program

Uses of Java

Java is widely used to develop applications across different platforms and industries. Some common uses include:

  • Mobile Applications: Used to develop Android applications and maintain existing Android projects.
  • Desktop Applications: Used to build graphical applications using JavaFX and Swing.
  • Web Applications: Used to develop web applications and REST APIs using frameworks such as Spring Boot.
  • Enterprise Applications: Used to build banking, e-commerce, and business management systems.
  • Game Development: Used to create games with frameworks such as LibGDX and jMonkeyEngine.
  • Big Data Applications: Used in distributed data processing and event-streaming systems such as Apache Hadoop and Apache Kafka.
  • Cloud Applications: Used to develop cloud-based applications, microservices, and backend services.
  • IoT and Embedded Systems: Used to develop applications for supported embedded devices and connected systems.
  • Database Applications: Uses JDBC to connect with relational databases and perform database operations.
Comment