Question:
Into what does the Java Compiler translate source code?
Java Compiler सोर्स कोड का अनुवाद किसमें करता है?
Options:
- Machine code
- Assembly code
- Byte code
- JVM code
- मशीन कोड
- एसेम्ब्ली कोड
- बाइट कोड
- JVM कोड
Correct Answer: c)
Explanation:
Detailed Explanation:
The correct answer is c) Bytecode (बाइट कोड).
The Java Execution Architecture:
- Compilation Phase: When Java source code (written in
.javafiles) is compiled using the Java compiler (javac), it is translated into an intermediate, architecture-neutral instruction format known as Bytecode, which is saved in.classfiles. - Platform Independence: Bytecode is not machine code for any specific physical CPU; instead, it consists of highly optimized instructions designed to be executed by the Java Virtual Machine (JVM). This enables Java’s primary capability: “Write Once, Run Anywhere” (WORA).
- Execution Phase: At runtime, the JVM interprets the bytecode or uses a Just-In-Time (JIT) compiler to compile hot paths of bytecode directly into native machine code for the host processor.
विस्तृत व्याख्या:
सही उत्तर c) बाइट कोड (Bytecode) है।
जावा (Java) निष्पादन प्रक्रिया:
- कंपाइलेशन चरण: जब जावा सोर्स कोड (
.javaफ़ाइल) को जावा कंपाइलर (javac) द्वारा कंपाइल किया जाता है, तो यह सोर्स कोड को सीधे मशीन कोड में न बदलकर एक मध्यवर्ती (Intermediate) कोड में बदलता है, जिसे बाइट कोड (Bytecode) कहा जाता है। यह कोड.classफ़ाइलों में संग्रहीत होता है। - प्लेटफॉर्म स्वतंत्रता: बाइट कोड किसी विशेष हार्डवेयर या ऑपरेटिंग सिस्टम पर निर्भर नहीं होता। इसे किसी भी सिस्टम पर स्थापित जावा वर्चुअल मशीन (JVM) द्वारा निष्पादित किया जा सकता है, जो जावा के प्रसिद्ध सिद्धांत “Write Once, Run Anywhere” (एक बार लिखें, कहीं भी चलाएं) को संभव बनाता है।
- रनटाइम पर JVM का JIT (Just-In-Time) कंपाइलर इस बाइट कोड को वास्तविक मशीन कोड में बदलता है।