 By analyzing the source code and using the theory and implementation of the language, the compiler will attempt to correctly translate the high-level code into low-level code, preserving the behavior of the program.During compilation of programs written in a type-safe language, such as Java, the source code must type-check successfully before compilation.If the type-check fails, the compilation will not be performed, and the source code needs to be modified.