Q: Which language is platform-independent and can run on any operating system with a JVM?
-
A
C
-
B
C++
-
C
Java
-
D
None of the above
C
Answer:
C
Explanation:
Java is a platform-independent language, which means it can run on any operating system or device that has a Java Virtual Machine (JVM) installed. Java achieves this independence through a process in which code is first compiled into an intermediate form known as bytecode. This bytecode is not specific to any machine's hardware but is instead interpreted by the JVM, which adapts it to the specific platform it’s running on. In contrast, C and C++ are platform-dependent languages because they compile directly into machine code that is specific to the operating system and hardware. As a result, C and C++ code must be recompiled to run on different platforms, while Java bytecode can execute on any platform with a JVM, making it inherently more flexible and portable for cross-platform development.
Related Topic:
Share Above MCQ