C++ is considered to be a purely compiled language whereas Java is not.
To those who have no idea about what a compiled language is, the definition is as follows.
Compiled Language: A language that requires a compiler program to turn programming source code into an executable machine-language binary program. After compiling once, the program can continue to be run from its binary form without compiling again
The last line of the above definition is really important.It is what emphasizes the main difference of a compiled language vs interpreted language.
To illustrate the main idea of this post, let's look deep into how the compilation process work in C++ and Java. The following image illustrates how a source file in C or C++ gets converted into machine language.
As you can see in C++, once the compilation is done, it is already converted into machine code( Even without the linking process ). An Object file contains machine instructions for that specific source file.The linking process links all the object files and makes a single executable which can be executed on that platform. Therefore whenever you want to run this program, what you do is run the executable.You do not need to compile it again.
In Java the process is a bit different. The following image explains how it is done.
In Java when you run " javac MyClass.java "the output is a .class file( contains byte code).This file is platform independent, and you can run the same file within different platforms(Linux or Windows or MacOS). Which means if you compile the source in a windows machine, and you run the .class file in a Linux machine, the program works exactly the same (you should have the JRE to run a java program). If you have a Java Runtime Environment installed on your computer, there exists a Java Interpreter in it which is able to run a .class file ( converts byte code in .class to machine instructions). when you execute "java MyClass", what really gets executed is this .class file.
Therefore as you can see, Java is not a purely compiled language. it does not convert the source file into an executable by only using the compiler. It uses a program called the Interpreter which gets executed each time when you run that Java program. It is what converts the .class into 1s and 0s and makes your program understandable to your machine.

