Getting Started Lesson 1 of 21
Introduction to Java
What Java is, where it's used, how "write once, run anywhere" works with the JVM, and what a first Java program looks like.
Java was created by James Gosling and his team at Sun Microsystems and released in 1995. It's now owned by Oracle and is free to use. Decades later, it's still one of the top programming languages, because it's reliable, fast and runs almost anywhere.
Your first Java program
public class Main {
public static void main(String[] args) {
System.out.println("Mabuhay, Pilipinas!");
}
}
Output
Mabuhay, Pilipinas!
That's more code than Python's one-line print("..."), but every part has a purpose:
public class Main: all Java code lives inside a class. This one is namedMain.public static void main(String[] args): the main method, where every Java program starts running.System.out.println(...): prints a line of text.- Curly braces
{ }mark where the class and the method begin and end. - The statement ends with a semicolon
;.
For now, think of the first two lines as a template you copy every time. You'll understand each word by the end of the course.
Where is Java used?
- Android apps: Android was built around Java, and many apps are still written in it (or in Kotlin, its close cousin).
- Banks and big companies: online banking, payroll, airline booking and government systems often run on Java.
- Web servers: frameworks like Spring Boot power the back end of many websites.
- Games: Minecraft Java Edition is written in Java.
- School and certification: Java is common in TVL-ICT Computer Programming, college IT/CS courses and the TESDA Programming NC III assessment.
Write once, run anywhere
Most languages are translated directly into instructions for one kind of computer. Java works differently:
- You write source code in a
.javafile. - The Java compiler (
javac) translates it into bytecode, saved in a.classfile. - The Java Virtual Machine (JVM) runs the bytecode on any computer: Windows, Mac, Linux.
Main.java ──javac──▶ Main.class (bytecode) ──java (JVM)──▶ runs on any computer
That's Java's famous promise: "write once, run anywhere".
Java is strict, and that's good
Java checks your code carefully before it runs. Every variable has a declared type, and many mistakes are caught by the compiler instead of crashing later. This strictness makes Java slightly harder at the start but excellent for large, reliable programs, which is why banks trust it.
Java versus JavaScript
Despite the name, Java and JavaScript are completely different languages. JavaScript was named after Java in 1995 as a marketing move, because Java was popular at the time. They share some syntax (curly braces, if, for), but they're used for different things and work very differently.
Quick Quiz
Check what you learned. Walang grade ito, practice lang. 🙂
By Sir Reyel · Last updated 2026-12-04