Introduction to Java

Introduction to Java

Java is one of the most widely used programming languages in the world. It was originally created at Sun Microsystems in the mid-1990s and is now maintained by Oracle and a large open source community.

Why Java is still relevant

  • Cross platform, runs on many operating systems
  • Mature ecosystem with frameworks like Spring and build tools like Maven or Gradle
  • Strong typing, many bugs are caught by the compiler
  • Huge community and documentation

Java, JVM and bytecode

When you compile Java code:

  1. The Java compiler (javac) turns your .java files into bytecode (.class files).
  2. The Java Virtual Machine (JVM) runs this bytecode on your operating system.

This is what enables the idea write once, run anywhere.

Your first Java program

Below is a minimal Java program that prints a message to the console:

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

The main method is the entry point. The JVM starts your program by calling it.

What you will learn next

In the next lessons we will cover variables, data types, conditionals, loops, methods, classes, objects and collections.