Compiler vs Interpreter

Compiler

The compiler scans the entire source code and translates the whole of it into machine code at once.

The code you write is usually converted into another form that a computer knows how to run. This process is called compilation, and the period this happens is called "compile time."

After compilation, the program is launched, and the period it's running is called "runtime."

Types of programming languages that use compilers are

C

C++

Rust

Haskell

Erlang

Interpreters

The Interpreter translates just one statement of the source code at a time into machine code at runtime.

Type of programming languages that use interpreters are

Python

PHP

Perl

Ruby

What about JAVA?

The JAVA is a combination of both.

It first compiles the source code into byte code and uses Java Virtual Machine (JVM) to interpret the Java byte code.