Bird
0
0

Given this Kotlin code compiled to JVM bytecode, what will be printed when run?

medium📝 Predict Output Q4 of 15
Kotlin - Basics and JVM Runtime
Given this Kotlin code compiled to JVM bytecode, what will be printed when run?
fun main() { println("Hello JVM") }
Afun main() { println("Hello JVM") }
BHello JVM
CCompilation error
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Understand the Kotlin main function

    The main function prints the string "Hello JVM" to the console.
  2. Step 2: Confirm compilation and execution

    Since code compiles to JVM bytecode and runs correctly, output is the printed string.
  3. Final Answer:

    Hello JVM -> Option B
  4. Quick Check:

    Running Kotlin JVM bytecode prints output [OK]
Quick Trick: Kotlin main prints output when run on JVM [OK]
Common Mistakes:
MISTAKES
  • Expecting source code as output
  • Thinking compilation fails
  • Assuming no output without println

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes