Single Choice Easy

QWhich escape sequence combination is used to represent a newline on both Windows and Unix-based systems?

ID: #19874 Escape sequences in Java 106 views
Question Info
#19874Q ID
EasyDifficulty
Escape sequences in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A \n\r
  • B \r\n
  • C \n\n
  • D \r\r
Correct Answer

Explanation

Answer: B)
The correct escape sequence combination to represent a newline on both Windows and Unix-based systems is \r\n.

Explanation:
The combination \r\n represents a newline in a way that is compatible with both Windows and Unix-based systems. It combines the carriage return and newline characters.

Description:
Understand the importance of newline representations in cross-platform development and how \r\n addresses compatibility issues.

Tags:
Java, Escape Sequences, Newline, Cross-Platform Development

Share This Question

Challenge a friend or share with your study group.