Single Choice Easy

QWhat does the escape sequence \r represent in Java?

ID: #19869 Escape sequences in Java 101 views
Question Info
#19869Q ID
EasyDifficulty
Escape sequences in JavaTopic

Choose the Best Option

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

  • A Newline
  • B Carriage Return
  • C Tab
  • D Backspace
Correct Answer

Explanation

Answer: B)
The correct escape sequence to represent a carriage return character in Java is \r.

Explanation:
The \r escape sequence is used to insert a carriage return character in a string. It is often used in combination with \n to represent the end of a line in different operating systems.

Description:
Understand the role of the carriage return escape sequence in Java and its significance in controlling the position of the cursor in the output.

Tags:
Java, Escape Sequences, Carriage Return, String Formatting

Share This Question

Challenge a friend or share with your study group.