answersLogoWhite

0


Best Answer

Java is both compiled and interpreted language.First Java source code has to be translated into Byte code, which is done with the help of a compiler.But these byte codes are not machine instructions. Therefore ,in second stage this byte code has to be translated into machine code.This task is performed by an Interpreter.Hence, Java use both compiler and interpreter.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

The java Compiler compiles the .java file. Like other compiled languages, the Java compiler does not produce machine code designed specifically for a particular type of computer. Instead, it produces a new file containing bytecode, and this file has the .class extension. Bytecode is like an idealised form of machine language, and the really special thing about bytecode is that it is not machine dependent. So that only one type of computer can read it, any computer (that has the Java interpreter installed) can read and understand bytecode. The interpreter on your computer takes the Java bytecode in the .class file, turns it into machine code which your particular computer can understand, and then executes (or "runs") the code.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Java source code is compiled down into Java bytecode. This bytecode is then interpreted by the Java Virtual Machine during execution.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why java has compiler and interpreter both?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is java interpreter or compiler?

Java has both a compiled and an interpreted stage.1) The programmer writes his source codes (.java extension); a compiler will compile this to bytecode (.class extension).2) When the end-user runs the .class program, the JVM (Java Virtual Machine) will interpret this.


What are the different phases of java?

Based on the lecture i have , there are three JAVA PHASES -- editor. First step in creating java program is by writing ur programms in a text editor. Ex, notepad, emacs etc -- java compiler. compile. The program by. Using the java compiler. The output of this process is a file of java bytecodes wid the file extension.class -- java interpreter. The .class file is then interpreted by java interpreter that converts the bytecodes into the machine language of the particular computer your using ---abioo4---


Is jvm a compiler?

Basically they do the same: converting from one level of language into another. A compiler converts high level language (programming language like java) into machine-language. That is language a computer understands. An interpreter converts high level language into an intermediate level. When a program is exectuted, that intermediate level is reconverted to machine language.


What is a hybrid compiler?

Hybrid compiler is a compiler which translates a human readable source code to an intermediate byte code for later interpretation. So these languages do have both features of a compiler and an interpreter. These types of compilers are commonly known as Just In-time Compilers (JIT). Java is one good example for these types of compilers.


Difference Between interpreter and compiler in java application?

Due to platform independence, a Java compiler will interpret Java source code into Java Byte Code and pass to the JVM, which will pass machine understandable code through to cpu. (clarification needed).A conventional compiler converts source code directly to machine code.(clarification needed).

Related questions

Is java interpreter or compiler?

Java has both a compiled and an interpreted stage.1) The programmer writes his source codes (.java extension); a compiler will compile this to bytecode (.class extension).2) When the end-user runs the .class program, the JVM (Java Virtual Machine) will interpret this.


Is jvm a compiler or an interpreter?

JVM is an Interpreter because it interprets the Java Byte Code which it is feed and then it executes it line by line.


What are the different phases of java?

Based on the lecture i have , there are three JAVA PHASES -- editor. First step in creating java program is by writing ur programms in a text editor. Ex, notepad, emacs etc -- java compiler. compile. The program by. Using the java compiler. The output of this process is a file of java bytecodes wid the file extension.class -- java interpreter. The .class file is then interpreted by java interpreter that converts the bytecodes into the machine language of the particular computer your using ---abioo4---


Is jvm a compiler?

Basically they do the same: converting from one level of language into another. A compiler converts high level language (programming language like java) into machine-language. That is language a computer understands. An interpreter converts high level language into an intermediate level. When a program is exectuted, that intermediate level is reconverted to machine language.


What is a hybrid compiler?

Hybrid compiler is a compiler which translates a human readable source code to an intermediate byte code for later interpretation. So these languages do have both features of a compiler and an interpreter. These types of compilers are commonly known as Just In-time Compilers (JIT). Java is one good example for these types of compilers.


Difference Between interpreter and compiler in java application?

Due to platform independence, a Java compiler will interpret Java source code into Java Byte Code and pass to the JVM, which will pass machine understandable code through to cpu. (clarification needed).A conventional compiler converts source code directly to machine code.(clarification needed).


Compiler and interpreter belongs to which category of software?

Both are "System Softwares".


What are the similarities between compiler and interpreter?

Both compiler and interpreter are the language programs that translates source program into machine code or we can say object code. Both are used to find errors in source program.


How many model of compiler?

combination of interpreter and compiler.


What is the best compiler can be used to create Java programs?

A Java compiler.


Similarities between compiler interpreter assembler?

Both are use to convert high level languages into machine language


What is a compiler and an interpreter?

a compiler translates an entire program and then executes it while an interpreter translates and executes one line of a program at time