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 the use of generics? When was it added to the Java development Kit?

540


what are three ways in which a thread can enter the waiting state? Or what are different ways in which a thread can enter the waiting state? : Java thread

505


Difference between static synchronization vs. Instance synchronization?

545


When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

594


how is final different from finally and finalize in java?

592






what is the difference between preemptive scheduling and time slicing? : Java thread

519


Why do we need variables?

518


What are the main uses of this keyword?

583


what do you mean by stream pipelining in java 8? Explain

518


v-model life cycle

1606


Is map sorted in java?

556


How do you delete a list in java?

518


What does singleton class mean?

524


what is thread in Java ?

612


What is the purpose of return statement?

613