Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Java bytecode

Tags:

java

bytecode

I am studying for a Java certificate and I got a question that I know it could be really basic. However, I am not sure:

Question: Which statement is true about Java bytecode?

a) It can run on any platform.
b) It can run on any platform only if it was compiled for that platform.
c) It can run on any platform that has the Java Runtime Environment.
d) It can run on any platform that has a Java compiler.
e) It can run on any platform only if that platform has both Java Runtime Environment and Java compiler.

I think (c) is the correct answer, assuming that the Java Runtime Environment is the interpreter.

like image 938
Cuban coffee Avatar asked Dec 02 '15 00:12

Cuban coffee


2 Answers

The answer would be C.

Java bytecode is already the compiled form of the Java source code, and the Java compiler is only available with the Java Software Development Kit (SDK). Once code has been compiled, it does not need to be compiled again.

All the system needs is the Java Runtime Environment (JRE) because the JRE is able to interpret the bytecode and run it on the system.

like image 116
Zizouz212 Avatar answered Nov 03 '22 00:11

Zizouz212


The Java Runtime Environment (JRE) is a software package which bundles the libraries (jars) and the Java Virtual Machine, and other components to run applications written in the Java. JVM is just a part of JRE distributions.

To execute any Java application, you need JRE installed in the machine. It’s the minimum requirement to run Java applications on any computer.

So, my answer would be C.

like image 35
Mert Avatar answered Nov 03 '22 01:11

Mert