KnowledgeBoat Logo

Computer Applications

Which of the following is an escape sequence character in Java?

  1. /n
  2. \t
  3. /t
  4. //n

Values & Data Types Java

ICSE 2024

3 Likes

Answer

\t

Reason — In Java, an escape sequence is a combination of characters starting with a backslash (\) followed by a specific character that performs a special operation.

Analysing the given options:

  1. /n – Incorrect, should be \n (Backslash is required).
  2. \t – Correct, it represents a tab.
  3. /t – Incorrect, should be \t.
  4. //n – Incorrect, this is not an escape sequence; // is used for comments in Java.

Answered By

1 Like


Related Questions