
The main drawbacks are poor portability as programs have to be compiled for a specific CPU architecture and a long time that is required for the actual compilation.
HOW IS COMPILING JAVA DIFFERENT FROM COMPILING C CODE
The main benefit of compiled languages is the speed of execution as the executable that contains machine code can be directly executed on the target machine without any additional steps. The compilation process consists of preprocessing, compiling and linking, but the end result is either a library or an executable that can be executed directly by a CPU that the program was compiled for. In C++ the source code is compiled into machine code. A standard compiler instead of translating code on the fly does all of its work ahead of execution time.Ī good example of a compiled language is C++.

A compiler is a program that translates statements written in a particular programming language into another language usually machine code. Compiled LanguagesĪ compiled language is a programming language that is typically implemented using compilers rather than interpreters. This is a standard process present in all of Java’s popular implementations. Java can be a good example of such a language as Java’s source code is compiled to an intermediate representation called bytecode and interpreted by Java’s interpreter that is a part of Java Virtual Machine (JVM). In fact, there are many programming languages that have been implemented using both compilers and interpreters.

One of the main things we have to understand is that a programming language itself is neither compiled nor interpreted, but the implementation of a programming language is. The main goal of both compilation and interpretation is to transform the human-readable source code into machine code that can be executed directly by a CPU, but there are some caveats to it. One of the common although not ideal ways to differentiate them is to split them into 2 groups compiled and interpreted languages. When it comes to code compilation and execution, not all programming languages follow the same approach.
