Skip to content
Qyubie Learn
Java tutorialLesson 1 of 18 · tap to see all lessons

Java tutorial · Beginner

Introduction to Java: History, Features, JDK, and JVM

What Java is, where it came from, how it differs from C, and how the JDK, compiler, and JVM turn your code into a running program.

  • Qyubie Learn Editorial Team
  • Published
  • 7 min read

Includes 3 quick checks you can do right here.

Java is one of the most widely taught programming languages in the world. It runs Android apps, bank systems, school portals, and the back ends of many websites. Before writing code, it helps to know what Java is and what happens when you press Run.

By the end of this lesson you will be able to:

  • describe where Java came from and why it became popular,
  • list Java's main features and where it is used,
  • compare Java with C, and
  • explain what the JDK, the compiler (javac), and the JVM each do.

A short history

  • 1991: a team at Sun Microsystems led by James Gosling started a project for programming small devices like set-top boxes. The language was first called Oak.
  • 1995: it was renamed Java and released publicly. Its promise was "write once, run anywhere."
  • 2006–2007: Sun released most of Java as open source (the OpenJDK project).
  • 2010: Oracle bought Sun and has led Java's development since.
  • Today: a new Java version comes out every six months. Some versions are LTS (long-term support) and are the ones most schools and companies install.

Features of Java

FeatureWhat it means for you
Platform independentYour compiled program runs on Windows, macOS, or Linux without changes, as long as a JVM is installed.
Object-orientedPrograms are built from classes and objects (you'll learn these in the OOP lessons).
Strongly typedEvery variable has a type, and the compiler catches many mistakes before the program runs.
Automatic memory managementA garbage collector frees memory you no longer use. You never call free() like in C.
Large standard libraryReady-made classes for text, math, files, networking, dates, and collections.
Secure and robustNo direct pointer arithmetic, array bounds are checked, and errors are reported as exceptions.
MultithreadedA program can do several tasks at the same time.

Where Java is used

  • Android apps (Android development uses Java and Kotlin, which runs on the same platform).
  • Enterprise and back-end systems: banking, school information systems, online stores.
  • Web applications: servers that answer browser requests. You'll build a small one at the end of this course.
  • Desktop tools and IDEs: IntelliJ IDEA, Eclipse, and NetBeans are themselves written largely in Java.
  • Big data and cloud tools that process huge amounts of data.

Quick check

What does "write once, run anywhere" mean for a Java program?

Java versus C

If you learned C in Fundamentals of Programming, much of Java's syntax will look familiar: if, for, while, int, double, curly braces, and semicolons all work almost the same. The big differences are underneath.

CJava
StyleProcedural (functions)Object-oriented (classes and objects)
Compiles toMachine code for one kind of computerBytecode that runs on the JVM
MemoryYou allocate and free it (malloc, free)Automatic, with a garbage collector
PointersYes, with pointer arithmeticNo pointers you can do math with; objects are used through references
TextArrays of char ending in '\0'The String class
Array boundsNot checked: reading past the end is undefined behaviorChecked: going past the end throws an exception
Printingprintf("%d", x);System.out.println(x); (and System.out.printf exists too)

Here is the same program in both languages:

#include <stdio.h>

int main(void) {
    printf("Hello, BSCS!\n");
    return 0;
}
public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, BSCS!");
    }
}

Output:

Hello, BSCS!

In Java, even the simplest program lives inside a class, and the program starts in a method called main.

JDK, JVM, and how a Java program runs

Three names come up constantly:

  • JDK (Java Development Kit): what you install to write Java. It contains the compiler javac, the launcher java, the standard library, and other tools.
  • JVM (Java Virtual Machine): the program that runs compiled Java code. It translates bytecode into instructions for your actual computer.
  • JRE (Java Runtime Environment): the JVM plus the standard library, the part needed only to run programs. Modern JDKs include it, so you just install the JDK.

A Java program goes through two steps:

  1. Compile: javac Hello.java checks your code and turns it into bytecode, saved as Hello.class. Mistakes like a missing semicolon are reported here.
  2. Run: java Hello starts the JVM, which loads Hello.class and runs the main method.
Hello.java  --javac-->  Hello.class (bytecode)  --java (JVM)-->  program runs

Since Java 11 you can also run a single file directly with java Hello.java. It compiles in memory and runs in one step, which is handy for small exercises.

Quick check

You run javac Hello.java. What file does it create?

Quick check

Which one actually runs the bytecode?

Setting up your computer

  1. Install a JDK. Choose a current LTS version, such as JDK 21 or JDK 25. Free builds include Eclipse Temurin (adoptium.net) and Oracle JDK.

  2. Check that it works. Open a terminal (Command Prompt on Windows) and type:

    java -version
    javac -version

    Both should print a version number. If Windows says the command is not recognized, the JDK's bin folder is not on your PATH. Reinstalling with the "set PATH" option, or adding it in Environment Variables, fixes this.

  3. Install an IDE (Integrated Development Environment), a code editor that also compiles, runs, and helps debug. Popular free choices:

    • IntelliJ IDEA
    • Eclipse IDE for Java Developers
    • Apache NetBeans
    • VS Code with the Extension Pack for Java
  4. Create a project, add a class named Hello, paste the program above, and press Run. You should see Hello, BSCS! in the output panel.

Common mistakes

  • Installing only a JRE. You need the JDK to get javac.
  • javac is not recognized. The JDK's bin folder is missing from PATH.
  • Running java Hello.class. Give the class name, not the file name: java Hello.
  • File name doesn't match the class. public class Hello must be saved as Hello.java.

Summary

  • Java was created at Sun Microsystems (James Gosling, 1995) and is now led by Oracle and the OpenJDK community.
  • It is object-oriented, strongly typed, platform independent, and manages memory for you.
  • Compared with C, Java has classes, a garbage collector, a String class, checked array bounds, and no pointer arithmetic.
  • javac compiles .java into .class bytecode, and the JVM runs it. The JDK includes everything you need.

Next lesson: Java program structure and syntax. We'll take the Hello program apart line by line.

References and further reading