Computer Science, asked by tsumisaron, 1 year ago

explain why Java program uses a compiler as well as an interpreter.

Answers

Answered by keerthika6
2
The Compiler of java called as javac converts source code into a Intermediate file known as Bytecode file. The Bytecode file is unique for all types of OS means bytecode is platform independent

Now

The Interpreter of java (java) converts Bytecode into the specific OS compatible machine code . This code will vary according to OS.

The Detailed Story:

What i s Bytecode file ? why it is called as Bytecode file ?

So, the answer is Bytecode is just like Shorthand language that store each keyword of java as a sign. and each sign takes 1 byte of memory in RAM. Hence the name called as Bytecode file.

Why we use both - Compiler as well as Interpreter in Java(Need of Separate compiler and Interpreter)

At the time of C and C++, only Compiler was there that converts source code into specific OS machine code. The machine code was OS dependent that varied from OS to OS.

The problem the programmer were facing that They had to design a different compiler for different Operating System that is too difficult, Too time consuming and much Costly.

Then Sun Microsystem take the whole Initiative by making :

a Unique compiler that produce Platform Independent Bytecodes and

the Specific JVM(Java Virtual Machine)or Interpreter that converts bytecodes into machine code that will vary from OS to OS.

and making different JVM for different OS was much easier and economical than the whole Compiler.

SO, The JAVA was more Popular and more in use than any Language

Answered by Anonymous
1

The code written using any programming language is either compiled or interpreted but Java comes with both the operations. First of all, Java compiler converts the source code into bytecode. Further, the bytecode is converted into an executable machine code using the Java interpreter.

______hope it helps u_______

Similar questions