Skip to content
UniCircle
EasyConceptualHow programs run

Compiled vs interpreted languages (and where Java and Python fit)

Question PROG-CMP-001

What is the difference between a compiled and an interpreted language? Is Java compiled or interpreted? What about Python? Where does a JIT compiler fit in?

Show the explanation

Strictly speaking, implementations are compiled or interpreted, not languages. In practice:

Ahead-of-time (AOT) compilation, as in C, C++, Rust and Go: a compiler translates the whole source into native machine code for one CPU and OS before the program runs.

  • + Fast start-up and fast execution. Many errors are caught at compile time.
  • − You must rebuild for each platform, and the compile step slows down quick experiments.

Interpretation: an interpreter reads the program and carries it out step by step at run time.

  • + Portable. Quick edit–run cycle.
  • − Usually slower, because work is repeated on every run.

The hybrid most languages actually use: bytecode plus a virtual machine

  • Java: javac compiles .java files to platform-independent bytecode (.class). The JVM first interprets that bytecode, then its JIT (just-in-time) compiler compiles frequently run methods to native code while the program runs. So Java is both compiled and interpreted. That is the "write once, run anywhere" model.
  • Python (CPython): source is compiled to bytecode (.pyc files in __pycache__), which the CPython virtual machine interprets. Recent CPython versions have added an experimental JIT. PyPy is an alternative implementation built around a JIT.
  • JavaScript: engines such as V8 parse the code, run it in an interpreter, and JIT-compile hot functions.

What a JIT adds: it can optimise using run-time information, such as which types actually occur and which branches are taken. That can sometimes beat static compilation. The cost is warm-up time and memory.

Short interview answer: "C and C++ compile ahead of time to machine code. Java compiles to bytecode that the JVM interprets and JIT-compiles. CPython compiles to bytecode and interprets it. The trade-off is start-up and run-time speed against portability and development speed."

Original UniCircle question. Last reviewed 22 Oct 2026.