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
| Feature | What it means for you |
|---|---|
| Platform independent | Your compiled program runs on Windows, macOS, or Linux without changes, as long as a JVM is installed. |
| Object-oriented | Programs are built from classes and objects (you'll learn these in the OOP lessons). |
| Strongly typed | Every variable has a type, and the compiler catches many mistakes before the program runs. |
| Automatic memory management | A garbage collector frees memory you no longer use. You never call free() like in C. |
| Large standard library | Ready-made classes for text, math, files, networking, dates, and collections. |
| Secure and robust | No direct pointer arithmetic, array bounds are checked, and errors are reported as exceptions. |
| Multithreaded | A 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
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.
| C | Java | |
|---|---|---|
| Style | Procedural (functions) | Object-oriented (classes and objects) |
| Compiles to | Machine code for one kind of computer | Bytecode that runs on the JVM |
| Memory | You allocate and free it (malloc, free) | Automatic, with a garbage collector |
| Pointers | Yes, with pointer arithmetic | No pointers you can do math with; objects are used through references |
| Text | Arrays of char ending in '\0' | The String class |
| Array bounds | Not checked: reading past the end is undefined behavior | Checked: going past the end throws an exception |
| Printing | printf("%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 launcherjava, 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:
- Compile:
javac Hello.javachecks your code and turns it into bytecode, saved asHello.class. Mistakes like a missing semicolon are reported here. - Run:
java Hellostarts the JVM, which loadsHello.classand runs themainmethod.
Hello.java --javac--> Hello.class (bytecode) --java (JVM)--> program runsSince 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
Quick check
Setting up your computer
-
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.
-
Check that it works. Open a terminal (Command Prompt on Windows) and type:
java -version javac -versionBoth should print a version number. If Windows says the command is not recognized, the JDK's
binfolder is not on yourPATH. Reinstalling with the "set PATH" option, or adding it in Environment Variables, fixes this. -
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
-
Create a project, add a class named
Hello, paste the program above, and press Run. You should seeHello, BSCS!in the output panel.
Common mistakes
- Installing only a JRE. You need the JDK to get
javac. javacis not recognized. The JDK'sbinfolder is missing fromPATH.- Running
java Hello.class. Give the class name, not the file name:java Hello. - File name doesn't match the class.
public class Hellomust be saved asHello.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
Stringclass, checked array bounds, and no pointer arithmetic. javaccompiles.javainto.classbytecode, 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.