COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Java is
A
Simple
B
Object Oriented
C
Platform dependent
D
interpreted
Explanation: 

Detailed explanation-1: -An. Java can be considered both a compiled and an interpreted language because its source code is first compiled into a binary byte-code. This byte-code runs on the Java Virtual Machine (JVM), which is usually a software-based interpreter.

Detailed explanation-2: -This might sound like a hint that Java is a purely interpreted language. However, before execution, Java source code needs to be compiled into bytecode. Bytecode is a special machine language native to the JVM. The JVM interprets and executes this code at runtime.

Detailed explanation-3: -Compiled code can run faster, but, unlike interpreted code in Java, it is not platform agnostic. The code written in a compiled language is converted directly into machine code that is specific to the targeted runtime architecture. Interpreted code is compiled into an intermediary that runs on any architecture.

Detailed explanation-4: -The Java source code first compiled into a binary byte code using Java compiler, then this byte code runs on the JVM (Java Virtual Machine), which is a software based interpreter. So Java is considered as both interpreted and compiled. The compiled byte code allows JVM to be small and efficient, and fast performing.

There is 1 question to complete.