Computer Science, asked by Sarim666, 4 months ago

Why Java converts source code to bytecode instead of converting source code directly to machine code?

Note : if you will answer this question correctly I will give you 7 thanx and I will follow you​​

Answers

Answered by nkrishitha900
0

Answer:

An interpreter does not convert byte code to machine code. It executes the byte code directly.

A compiler translates from one form to another without actually executing it ∗ , and so a program that converts byte code to machine code is indeed a compiler.

Many high-performance interpreters, especially for languages such as a Java, include Just In Time compilers. These compile the byte code to machine code at run-time.

Ahead of time compilers also exist for some interpreted languages. The GNU Java Compiler, for example, can compile either Java source or Java bytecode to native machine code.

Answered by aarshya65
2

Answer:

The Java compiler (javac) converts the source code into bytecode. Bytecode is a kind of average machine language. This bytecode file (.class file) can be run on any operating system by using the Java interpreter (java) for that platform. The interpreter is referred to as a Virtual Machine. Thus, Java is an example of a Virtual Machine programming language.

Virtual machine languages makes use of both a compiler and an interpreter. The compiler converts the source code into a kind of average machine language. In Java, this average machine language is called bytecode.

Similar questions