Lesson 1 of 25

Introduction to Java

What is Java?

Java is a powerful, object-oriented programming language developed by Sun Microsystems (now Oracle) in 1995. It follows the 'Write Once, Run Anywhere' principle — Java code compiled on one platform runs on any platform with a Java Virtual Machine (JVM).

Java is one of the most widely used programming languages, powering Android apps, enterprise systems, web backends, and more.

  • Object-oriented with strong typing
  • Platform independent via the JVM
  • Automatic memory management (garbage collection)
  • Rich standard library and ecosystem
  • Used by Netflix, Google, Amazon, and most enterprises

Your First Java Program

Every Java program starts with a class. The main method is the entry point of execution.

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

// Compile: javac HelloWorld.java
// Run: java HelloWorld
// Output: Hello, World!