01: Welcome to Java – The "Hello World" Foundation
So, you want to learn Java? You’re in the right place. Java is one of the most popular languages in the world, powering everything from Android apps to massive enterprise servers and even space-exploration software.
In this first tutorial, we’ll break down what Java actually is and write your very first line of code.
🛠 What exactly is Java?
Java is a high-level, object-oriented programming language. Its biggest "superpower" is a philosophy called WORA: Write Once, Run Anywhere. Unlike some languages that need to be rewritten for Windows, Mac, or Linux, Java code runs inside a JVM (Java Virtual Machine). This means as long as a device has the JVM, your code will run perfectly.
🧱 The Anatomy of a Java Program
Every piece of Java code must live inside a Class. Think of a class as a blueprint for a house. You can't live in the blueprint, but it tells you exactly how the house should be built.
The "Main" Method: The Front Door
In Java, the computer needs to know exactly where to start reading your instructions. That starting point is called the main method. Without it, your program simply won't run.
💻 Writing Your First Code
Let’s create a file named Main.java.
Important: In Java, the filename must match the Class name. If your class is
Main, your file must beMain.java.
public class Main {
public static void main(String[] args) {
// This is where the magic happens
System.out.println("Hello, World!");
}
}