Bird
0
0

Why does println add a new line after printing, but print does not in Kotlin?

hard📝 Conceptual Q10 of 15
Kotlin - Basics and JVM Runtime
Why does println add a new line after printing, but print does not in Kotlin?
Aprintln appends a newline character automatically, print does not
Bprint is deprecated and does not support new lines
Cprintln uses a different output stream than print
Dprint only works with numbers, println works with text
Step-by-Step Solution
Solution:
  1. Step 1: Understand function behavior

    println automatically appends a newline character after printing, moving the cursor to the next line.
  2. Step 2: Clarify misconceptions

    print does not add a newline; it prints text as is. It is not deprecated, uses the same output stream, and works with all data types.
  3. Final Answer:

    println appends a newline character automatically, print does not -> Option A
  4. Quick Check:

    println adds newline, print does not [OK]
Quick Trick: println adds newline automatically, print prints as is [OK]
Common Mistakes:
MISTAKES
  • Thinking print is deprecated
  • Believing print and println use different streams
  • Assuming print only works with numbers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes