Courseiva
1Z0-811Chapter 1 of 16Objective 1.1

Introduction to Java and the Java Platform

Java is a programming language that lets you write software once and run it on almost any device in the world. This concept, known as 'write once, run anywhere', is what makes Java one of the most popular languages for beginners and giant corporations alike. For your 1Z0-811 exam, understanding how Java achieves this portability — through the Java Virtual Machine and the Java Runtime Environment — is the foundation everything else builds on.

12 min read
Beginner
Updated Jul 23, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Introduction to Java and the Java Platform

The Commercial Kitchen Analogy

A commercial kitchen is a highly organised space designed to take raw ingredients and turn them into consistent, safe meals for hundreds of customers every day.

In this kitchen, the stove and ovens are the hardware — they are the physical machines that generate heat, just as computer hardware is the physical machine that processes instructions. The chef's recipe cards are your Java source code: they contain the exact steps to make a specific dish. But a recipe card cannot cook anything by itself. You need a head chef to read the recipe and tell the line cooks what to do. The head chef is the Java Virtual Machine (JVM). The JVM takes your Java code (the recipe) and translates it into actions the real kitchen equipment (the computer hardware) can perform. This means the same recipe card can be used in any kitchen that has a qualified head chef, whether it is a tiny food truck or a massive hotel kitchen.

Now, the kitchen itself comes with pre-stocked shelves of staples like oil, salt, and measuring cups. This is the Java Runtime Environment (JRE). The JRE provides everything the head chef (JVM) needs to run your recipe: a library of pre-written, tested cooking techniques (like chopping or boiling) that you do not have to invent from scratch. If you want to write new recipe cards, you need a full test kitchen with extra tools for measuring, tasting, and tweaking — that is the Java Development Kit (JDK). It contains the JRE plus all the tools a chef (developer) needs to create and debug new recipes.

How It Actually Works

Java is a general-purpose, object-oriented programming language created by James Gosling and his team at Sun Microsystems in the mid-1990s. 'General-purpose' means it can be used to build many kinds of software: from mobile apps and web servers to scientific calculators and banking systems. 'Object-oriented' is a way of organising code into reusable blueprints called 'classes', from which you create individual 'objects'. Think of a class as a cookie cutter, and each object as an actual cookie you make with it.

Before Java, most languages were compiled directly for a specific operating system and processor type. If you wrote a program for a Windows PC, it would not run on a Mac or a Linux machine without being heavily rewritten and recompiled. This was a huge problem for businesses that wanted their software to work on different hardware.

Java solved this with a brilliant two-step process. First, you write your source code in a plain text file (ending in .java). You use a tool called the 'compiler' (part of the Java Development Kit, or JDK) to convert that human-readable code into a special intermediate form called 'bytecode'. This bytecode is not executable by your computer's processor directly. It is designed to be executed by the Java Virtual Machine (JVM).

The JVM is a software program that acts as a pretend computer on top of your real computer. It takes the bytecode and interprets it line by line, translating each instruction into the specific machine-language commands your actual hardware needs. Because the JVM is built separately for each operating system (there is a JVM for Windows, one for Mac, one for Linux, etc.), your bytecode never needs to change. You compile once, and any device that has a JVM installed can run your program. This is the 'write once, run anywhere' promise.

The Java Runtime Environment (JRE) is the package you install on a computer to run Java programs. It includes the JVM plus a large collection of pre-built, ready-to-use code libraries, known as the Java Class Library. These libraries contain code for common tasks like drawing windows, reading text files, connecting to the internet, and handling dates. Without the JRE, programs would be enormous because every developer would have to write that basic functionality from scratch. When you download Java to play Minecraft on your laptop, you are installing the JRE.

The Java Development Kit (JDK) is a larger package intended for people who want to write Java programs, not just run them. It contains the entire JRE, plus development tools like the compiler (javac), the archiver tool (jar), and a documentation generator (javadoc). If the JRE is like having a DVD player, the JDK is like having a DVD player plus a film studio with editing equipment.

Key benefits of Java include:

Platform independence: your code runs on any device with a JVM.

Automatic memory management: Java has a 'Garbage Collector' that automatically frees up memory that your program is no longer using. In older languages like C++, forgetting to free memory caused crashes.

Rich standard library: the Java Class Library gives you thousands of pre-written classes for almost any task.

Strong community and corporate support: Oracle maintains Java, and millions of developers use it, so finding help online is easy.

Security: the JVM runs code in a controlled environment (the 'sandbox'), preventing malicious instructions from directly harming the host computer.

The 1Z0-811 exam tests your understanding of these core pieces: what the JVM is, what the JRE provides, and how the JDK differs from both. You need to know that the JVM is part of the JRE, and the JRE is part of the JDK. A common exam question asks: 'Which component allows Java to run on any platform?' The answer is the JVM.

This flowchart shows the Java development and execution pipeline: source code is compiled to bytecode by the JDK, then the bytecode is run by the JVM (part of the JRE) on any operating system and hardware.

Walk-Through

1

Write Source Code

You write Java instructions in a plain text file with a .java extension using any text editor or an Integrated Development Environment (IDE). For example, you create a file called Hello.java that contains a class and a main method.

2

Compile to Bytecode

You run the Java compiler (javac) on your source file. The compiler checks your code for syntax errors and, if successful, produces one or more .class files containing bytecode. For Hello.java, you get Hello.class. The JDK provides the javac tool.

3

Load the JVM

When you run a Java program using the 'java' command, the operating system launches the JVM application. The JVM is a process that starts running on your computer. It allocates memory and prepares to execute your bytecode.

4

Bytecode Verification and Execution

The JVM includes a bytecode verifier that checks the .class file for security and validity — ensuring no malicious or illegal instructions are present. After verification, the JVM interprets the bytecode, or optionally uses a Just-In-Time (JIT) compiler to convert frequently used bytecode into native machine code for faster execution.

5

Use the Java Class Library

During execution, if your code calls methods from the Java Class Library (like System.out.println or ArrayList), the JVM loads the appropriate .class files from the JRE's libraries into memory and executes them alongside your code. This integration happens automatically.

6

Program Termination and Cleanup

When your program finishes executing (reaching the end of the main method or calling System.exit), the JVM shuts down. The Garbage Collector may have already freed unused memory during execution. The JVM releases all allocated system resources back to the operating system.

What This Looks Like on the Job

Imagine you are a junior developer at a chain of 200 coffee shops called 'BrewWave'. Your boss asks you to write a small program that calculates the daily sales tax for each shop and sends the totals to head office. Each coffee shop uses a different type of computer: some run Windows, some use older Macs, and a few even use Linux-based point-of-sale systems.

If you wrote this program in a language like C++, you would need to create three separate versions of the program. You would compile one for Windows, one for macOS, and one for Linux. Keeping them all in sync whenever you fix a bug or change a tax rate would be a nightmare.

Instead, you write the tax calculator in Java. You install the JDK on your own development laptop. You write the source code in a file called TaxCalculator.java. When you run the compiler (javac TaxCalculator.java), it produces a file called TaxCalculator.class — this is your bytecode. You copy this single .class file into a shared folder in the cloud.

Now, each coffee shop's computer already has the JRE installed (as part of an earlier software update). The JRE contains the right JVM for that specific operating system. The shop manager double-clicks your TaxCalculator.class file. The JVM on that computer reads the bytecode and executes the program. It works perfectly on Windows, on the Mac, and on the Linux machine, with zero changes to the file.

A more complex real-world scenario involves building a web application for customers. You write Java servlets (server-side programs) that run inside a web server like Apache Tomcat. Tomcat itself is a Java program, so it runs on the JVM. You deploy the same bytecode to a development server (for testing), a staging server (for final checks), and a production server (for real customers) — and it behaves identically on all three.

What does an IT professional actually do day-to-day? - They download and install the appropriate JDK for their operating system from the Oracle website (or use an open-source version like OpenJDK). - They set an environment variable called JAVA_HOME that points to where the JDK is installed. - They use an integrated development environment (IDE) like IntelliJ IDEA or Eclipse to write code. The IDE uses the JDK's compiler automatically. - They use the 'java' command to run compiled programs and check that the classpath (the location of other Java libraries) is set correctly. - They troubleshoot 'ClassNotFoundException' errors — this happens when the JVM cannot find a required library, often because the classpath is misconfigured. - They install the JRE on user-facing servers and employee computers so that their Java applications will run.

The key takeaway for a junior is that you spend less time worrying about the underlying operating system and more time focusing on the logic of your program. Java's platform independence is a genuine timesaver in any organisation that uses mixed hardware.

How 1Z0-811 Actually Tests This

The 1Z0-811 exam is an entry-level test for Java foundations. The objective 1.1 'Describe the features and benefits of Java, the Java Virtual Machine (JVM), and the Java Runtime Environment (JRE)' appears in the first few questions. The exam expects you to know the roles of these components cold, and to distinguish between them.

What exam topics appear? - The purpose of the JVM: it interprets bytecode and provides a runtime environment for Java programs. It is platform-dependent. - The composition of the JRE: JVM + core libraries. The JRE is used to run Java programs. - The composition of the JDK: JRE + development tools (compiler, debugger, etc.). The JDK is used to create Java programs. - 'Write once, run anywhere' (WORA): this is Java's main selling point. The exam will ask which component makes it possible (answer: the JVM). - The Garbage Collector: automatic memory management that runs in the JVM. - The Java Class Library (also called the Java API): a set of pre-written classes that developers can use.

Common exam traps:

The exam will list a feature and ask whether it belongs to the JVM, JRE, or JDK. For example: 'Which component includes the compiler?' The answer is the JDK. A trap is that beginners say 'the JRE' because they confuse 'running' with 'creating'.

A question might say: 'Java programs are compiled into bytecode. True or false?' True. But then it asks: 'Bytecode can be executed directly by the computer's CPU.' False. Only the JVM can execute bytecode.

Another trap: 'The JVM is platform-independent.' False. The JVM itself is platform-dependent, because it must be written specifically for each operating system. It is the bytecode that is platform-independent.

They might ask: 'Which component provides the class libraries required for file input and output?' Answer: the JRE (since the JRE includes the Java Class Library).

Key definitions to memorise exactly:

JVM: the engine that drives the Java code. It loads, verifies, and executes bytecode. Provides memory management and security.

JRE: the runtime environment that provides the JVM and all the core classes needed to run Java programs. It does not include development tools.

JDK: the development kit that includes the JRE plus tools for developing and debugging Java programs.

Bytecode: the intermediate representation of your Java source code, stored in .class files.

Compiler: the tool (javac) that transforms .java source files into .class bytecode files.

The exam also sometimes asks about the history of Java (released by Sun Microsystems in 1995, now owned by Oracle). They expect you to recognise that Java is free for development and testing, but requires a license for certain commercial use on desktop computers (though this nuance is unlikely at the foundations level).

Finally, the exam will present scenarios: 'A developer writes a Java program and wants to deploy it on a server that only has the JRE. Will it run?' Yes, because the JRE contains the JVM and libraries. 'What about compiling new code on that server?' No, because the JRE lacks the compiler. For compiling, you need the JDK.

Key Takeaways

Java source code (.java) is compiled into bytecode (.class) by the compiler (javac), which is part of the JDK.

The Java Virtual Machine (JVM) is platform-dependent software that executes platform-independent bytecode.

The Java Runtime Environment (JRE) provides the JVM and the core libraries needed to run Java programs, but it does not include development tools like the compiler.

The Java Development Kit (JDK) contains the JRE plus tools for developing, debugging, and packaging Java applications.

Java's 'write once, run anywhere' capability is made possible by the JVM, which abstracts away the underlying operating system and hardware.

The Garbage Collector in the JVM automatically manages memory by removing objects that are no longer referenced, preventing memory leaks.

The Java Class Library (part of the JRE) provides thousands of pre-written classes for common tasks, so developers do not need to write low-level code from scratch.

The JDK is required for compiling Java code; the JRE is sufficient for running pre-compiled Java programs.

The JVM is a software program, not a physical chip, and it must be installed separately for each operating system.

Java was originally developed by Sun Microsystems and is now maintained by Oracle Corporation.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

JDK (Java Development Kit)

Includes the compiler (javac), debugger, and other development tools

Used by developers to create, compile, and debug Java programs

Larger in size (hundreds of MB) because it contains extra tools and documentation

JRE (Java Runtime Environment)

Does not include the compiler or development tools

Used by end-users to run pre-compiled Java programs

Smaller in size (around half the size of the JDK) because it only contains the JVM and libraries

JVM (Java Virtual Machine)

A single component: the virtual machine that executes bytecode

Platform-dependent (each OS has its own JVM implementation)

Cannot run programs alone; needs the class libraries provided by the JRE

JRE (Java Runtime Environment)

A package that includes the JVM plus the core Java class libraries

As a package, it is platform-dependent (since it contains the JVM), but the libraries are the same across platforms

Self-sufficient for running Java programs; you do not need anything else

Compiled Languages (e.g., C++)

Source code is compiled directly into native machine code for a specific OS and CPU architecture

The compiled executable (.exe on Windows) will not run on a different OS without recompilation

No intermediate bytecode or virtual machine layer; execution is faster but not portable

Java

Source code is compiled into bytecode, which is then executed by the JVM

The same bytecode runs on any OS that has a JVM, providing portability

Execution is slightly slower due to the JVM interpretation/JIT compilation, but portability and security are prioritised

Garbage Collector (GC)

Automatic: the JVM decides when to free memory occupied by objects no longer in use

Reduces the risk of memory leaks and programming errors like dangling pointers

Introduces occasional pauses in program execution (GC pauses)

Manual Memory Management (e.g., C/C++)

Manual: the developer must explicitly free memory using functions like free() or delete

Faster and more predictable execution, but prone to human errors like forgetting to free memory or freeing it twice

No GC pauses, but memory leaks are common in large, complex programs

Watch Out for These

Mistake

Java is the same as JavaScript. If I learn JavaScript, I can skip Java.

Correct

Java and JavaScript are completely different languages with different syntax, purposes, and runtime environments. Java is compiled to bytecode and runs on the JVM; JavaScript is interpreted and runs in web browsers.

Both names contain 'Java', and both are used for web-related development, so beginners assume they are related. Sun Microsystems named JavaScript for marketing reasons, not technical ones.

Mistake

The JVM is a physical piece of hardware inside my computer.

Correct

The JVM is software — a program that emulates a computer. It is not a physical chip. It is installed as part of the JRE or JDK.

The term 'virtual machine' sounds like a physical machine (like a virtual server in the cloud). Beginners often imagine a separate CPU inside their computer specifically for Java.

Mistake

Java code runs directly on the operating system without any intermediate layer.

Correct

Java code is compiled to bytecode, which then runs on the JVM. The JVM translates bytecode to machine code. There is always the JVM layer between the program and the OS.

In languages like C or C++, compiled executables run directly on the OS. Beginners assume Java works the same way because they run a command and see output instantly.

Mistake

The JDK is just a nicer version of the JRE with more features for running programs.

Correct

The JDK includes the entire JRE plus development tools. You can run Java programs with either, but you can only compile new programs with the JDK.

Both the JDK and JRE contain the 'java' command, so beginners think they are interchangeable. They try to compile code with a JRE-only installation and get an error, leading to confusion.

Mistake

Once I install the JDK, I can run Java programs on any device, even if that device does not have anything installed.

Correct

The JDK is installed on your development machine. The program you create (the .class file or .jar file) will run on any device that has a JRE installed. The JDK itself does not travel with your program.

Beginners think the JDK is like a portable app that magically makes Java works everywhere. They do not understand the distinction between development environment and runtime environment.

Mistake

The Garbage Collector in Java is optional and I can turn it off to improve performance.

Correct

The Garbage Collector is an integral part of the JVM and runs automatically. You can configure its behaviour (like choosing between different GC algorithms), but you cannot completely disable it.

Some older languages like C++ give developers full manual control over memory. Beginners coming from that background try to 'optimise' by disabling automatic memory management, not realising Java is designed to rely on it.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

Do I need to install the JDK or the JRE to learn Java?

You need the JDK because it contains the compiler (javac) that turns your .java source files into .class bytecode files. The JRE alone cannot compile code.

Can I run a Java program on a computer that only has the JRE installed?

Yes. The JRE contains the JVM and the core libraries, which are sufficient to run pre-compiled Java programs (.class files or .jar archives). You do not need the JDK to run Java programs.

Is Java free to download and use?

Yes, the JDK and JRE are free for development, testing, and personal use. For some commercial uses, you may need a paid Oracle license, but the OpenJDK builds (which are fully compatible) are completely free and open-source.

What is the difference between the JVM and the JRE?

The JVM is a component of the JRE. The JRE contains the JVM plus all the core Java class libraries required to run programs. The JVM alone cannot run programs because it lacks the libraries.

Why do people say Java is 'platform-independent' when the JVM itself depends on the platform?

Java bytecode is platform-independent. You compile once, and any device with a JVM (which is platform-dependent) can execute that bytecode. The platform dependence is shifted to the JVM, so your source and bytecode remain portable.

What happens if I try to run a .class file without a JVM installed?

Nothing will happen. The operating system will not recognise the file format. You will see an error message like 'Java not recognised as an internal or external command' or 'Could not find or load main class'. You must have the JRE installed to run .class files.

Is Java the same as JavaScript?

No. They are completely different languages. Java is compiled to bytecode and runs on the JVM; JavaScript is an interpreted language that runs in web browsers. The similarity in name is a historical marketing decision by Sun Microsystems.

Terms Worth Knowing

Keep going

You've finished Introduction to Java and the Java Platform. Continue through the 1Z0-811 study guide to build a complete picture of the exam.

Done with this chapter?