Every program you write in Java eventually has to become something the CPU can execute. This subtopic is about the tools that make that translation happen, and the trade-offs between different levels of programming language.
Programming languages are broadly classified by how close they are to what the hardware directly understands:
| Level | Description | Example |
|---|---|---|
| Low-level language | Close to machine code; hardware-specific, fast, but hard for humans to read/write and not portable between different CPU types | Assembly language, machine code |
| High-level language | Closer to human language; easier to read, write, debug and port across platforms, but must be translated before the CPU can run it | Java, Python, C# |
Language translators convert source code into a form the computer can execute:
Comparing and recommending: compiled programs generally run faster (already translated) but must be recompiled after every change; interpreted programs are slower to run but faster to test/debug during development since there's no separate compilation step.
Example
Java uses a two-stage approach: the Java compiler (javac) compiles your .java source files into .class bytecode files, and then the Java Virtual Machine (JVM) interprets/executes that bytecode at runtime — this is exactly why the same compiled Java program can run on Windows, macOS or Linux without changes.
💡 Exam Tip
If a question asks you to 'recommend' a translator type for a scenario, justify it: choose a compiler when execution speed and a distributable final product matter; choose an interpreter when rapid testing/debugging during development matters most.