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
Can a class have multiple subclasses?
Explain scope or life time of local variables in java?
Tell us something about set interface.
How can we create objects if we make the constructor private ?
What is data string?
What is a pattern what is an anti pattern?
Explain about anonymous inner classes in java?
Can we rethrow the same exception from catch handler?
What is abstract class? Explain
What is variable argument in java?
How to create a thread in java?
What is method overloading in JAVA? Why is it not present in C ?
What is sortedmap in java?
Explain the difference between serializable and externalizable in java?
What is subsequence of a string?