tags:

views:

174

answers:

5

I have two questions....

1) What does a Java Compiler actually do?
2) Why do we need compilers?

+2  A: 
  1. Compiler translates your source code into byte code that JVM can understand
  2. Without compiler the source code is just plain text file that computers or JVM can't understand, nor can run.
Ngu Soon Hui
What's JVM?....
Robert Harvey
Perhaps Wikipedia would be a better start: http://en.wikipedia.org/wiki/Java_compiler
WhirlWind
Java's Virtual Mojo...obviously..
Anthony Forloney
@Robert - Java Virtual Machine
thephpdeveloper
I am pretty damn sure, Robert knows what JVM is.
Anthony Forloney
So...what is php?
Lars Andren
+4  A: 

The compiler takes a source language like Java, and translates it into a machine executable form. In the case of Java, the compiler transates your Java code into Java bytecode that is then executed by a bytecode engine (the JVM, Java Virtual Machine). It is done this way so that you can write Java code that will run on many different machines (because you can write a JVM for each machine type).

We need compilers because it is hard to write programs in code that a machine can understand, so we use compilers to translate from a language that is human-readable into a language that is machine-executable.

Robert Harvey
+1  A: 

Compilers translate computer programs from a human readable form into a machine readable form.

smessing
A: 

Compiler is a program which is written to convert the java source code to the Machine understandable language, Compiler are very important in executing the programs.

harigm
A: 

You can find you answer here http://askville.amazon.com/compiler/AnswerViewer.do?requestId=35215184

necromancer