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

What is a “stateless” protocol ?

785


Define an abstract class with reference to java.

810


Is 0 a real number?

809


How can you add and remove nodes in jtree?

833


Does java have extension methods?

751


Can we have multiple classes in a single file?

760


Explain notify() method of object class ?

885


What are local variables?

836


What is default switch case? Give example.

802


Which is illegal identifier in java?

815


What is function declaration?

748


Why is boolean important?

828


Is boolean a data type in java?

752


What is the generic function?

759


What is java lang string?

788