How not to answer in interview #4 Is Java compiled or interpreted? #shorts #javaprogramming

preview_player
Показать описание
In this short we explain how not to answer in Java interview when questioned about Is Java compiled or interpreted? #shorts #javaprogramming

Generally freshers assume Java to be a compiled language only because it generates a .class file after compilation but its not the complete answer, Java is also an interpreted language as it makes usage of Just-In-Time(JIT) compiler which interprets the bytecode dynamically to optimize the performance. This compilation occurs on-the-fly during the execution of the program, targeting specific sections of code that are frequently executed.

So, in summary, Java source code is compiled into bytecode, which is then interpreted by the JVM. Additionally, the JVM may use a JIT compiler to further optimize the execution by compiling bytecode into machine code. This combination of compilation and interpretation allows Java to achieve both platform independence and performance.

Tell in comment section What is your way of giving correct answer?
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Subscribe to our channel and press the bell icon to get regular updates:
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
📌 Social Media
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Copyright © 2023 ScaleUp India - All Rights Reserved
Рекомендации по теме
Комментарии
Автор

At run time jvm(responsible to convert .class file into related OS) use both interpreter and compiler, interpreter to pick instruction one by one from .class file and give it to JIT(just in time compiler) which can hold multiple instructions and it is used to speed up the process of jvm

anuprana
Автор

java is both interpreted and compiled language.
JDK does compile the code using default java compiler and converts code to .class file during compile time.
While JVM does 2 things in runtime, firstly it interprets the compiled .class file to machine understandable instruction and also it finds hotspot(mostly used section) and converts to machine native code during runtime using inbuilt JIT(just in time) compiler.
JIT compiler makes the performance better for java code.

pritishbharat
Автор

Can you please comment on how to answer as well?

Mannam-ug