Bird
0
0

How can you print a multi-line message using only print in Kotlin?

hard📝 Application Q9 of 15
Kotlin - Basics and JVM Runtime
How can you print a multi-line message using only print in Kotlin?
AUse \n inside the string with print
BUse multiple print statements without \n
CUse println instead of print
DUse print with multiple arguments
Step-by-Step Solution
Solution:
  1. Step 1: Understand print behavior

    print does not add new lines automatically, but you can include newline characters \n inside the string to create line breaks.
  2. Step 2: Evaluate other options

    Multiple prints without \n won't create new lines; println adds new lines automatically; print does not accept multiple arguments.
  3. Final Answer:

    Use \n inside the string with print -> Option A
  4. Quick Check:

    Use \n in strings to create new lines with print [OK]
Quick Trick: Insert \n in strings to print new lines with print [OK]
Common Mistakes:
MISTAKES
  • Expecting print to add new lines
  • Using multiple prints without \n
  • Trying to pass multiple arguments to print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes