Bird
0
0

Identify the error in this Kotlin code snippet:

medium📝 Debug Q14 of 15
Kotlin - Basics and JVM Runtime
Identify the error in this Kotlin code snippet:
print("Hello")
println "World"
AMissing parentheses in println call
BMissing quotes around Hello
Cprint cannot be used without println
DNo error, code runs fine
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of print statement

    print("Hello") is correct with parentheses and quotes.
  2. Step 2: Check syntax of println statement

    println "World" is missing parentheses around the argument, which is required in Kotlin.
  3. Final Answer:

    Missing parentheses in println call -> Option A
  4. Quick Check:

    Function calls need parentheses = B [OK]
Quick Trick: Always use parentheses for function calls in Kotlin [OK]
Common Mistakes:
MISTAKES
  • Omitting parentheses in function calls
  • Thinking print needs println to work
  • Confusing quotes usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes