Oct 11, 2014

What does Java Compiler do

Job of Java Compiler

Before knowing What does Java Compiler do or Job of Java Compiler, You should know What is a compiler? Compiler is a collection of predefined programs which convert source code into machine understandable code. In case of Java Compiler source code is not converted into machine code directly, It is first converted into Byte code then translated into machine code by JVM. But other compiler directly convert source code into machine code. For ex- 'C' Compiler.
Due to this feature of Java, It is a Platform Independent Language. Java has both the Compiler and Interpreter. Compiler converts source code into byte code and the Interpreted i.e. JVM converts byte code into machine code.

Job of Java Compiler-

1. Java Compiler loads source code from Hard Disk to RAM.
2. Java Compiler converts source code into Intermediate code if source code is syntactically     correct.
3. Generate Byte Code i.e.  .Class file.

Note-  By default Byte code is saved into current working directory.