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 notifyall() method of object class ?

870


Is it possible to override the main method?

734


What is method overriding in java ?

879


What's the difference between int and integer in java?

847


What is encapsulation in java?

853


What is computer compiler?

757


Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?

740


What is use of super keyword?

752


What is deserialization?

807


What is string example?

810


Is it necessary that each try block must be followed by a catch block?

787


Why map is used in java?

810


What is passing parameters in java?

739


Why do we need singleton?

748


Can we print null in java?

785