In C we use only compiler. Why java uses both compiler and
interpreter? What is its significance?

Answer Posted / rinky

If a source code is written in C,then after compilation platform dependent native code is generated which is specific to the platform and whenever if you want to execute the same source code into different platform you have to recompile the program which is wastage of time.
srcprogram-->compile-->platform1---->platform native code
srcprogram-->compile-->platform2-->platform2 native code
But coming to Java,when you compile your source code ,an intermediate code is generated(.class file)which is common to all the platforms and you can execute the .class file on any platform with the help of jvm to generate native code of the specific platform.

src prg(.javafile)-->compile(on any platform Xplatform)-->bytecode(.classfile)-->jvm(execute on)-->platform(p1 or p2...or pn)(to get native code)
that is what java's passion compile once run anywhere

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between call by refrence and call by value?

568


What is anti pattern in programming?

502


What is hashmap in java?

573


What is scope & storage allocation of global and extern variables? Explain with an example

585


What are the two types of java programming?

541






Explain jvm, jre, and jdk?

565


What is the difference between the paint() and repaint() methods?

591


What package is math in java?

539


Explain parallel processing in java8?

637


What is double in java?

520


What about interthread communication and how it takes place in java?

551


Can a constructor call the constructor of parent class?

541


Does constructor return any value?

585


What is the difference between abstract class and interface1? What is an interface?

566


What is a parameter used for?

522