Escape Sequence

  • A character preceded by a backslash () is known as escape sequence.
  • There are total 8 escape sequences in Java which have special meaning to the compiler.
  • When we use an escape sequence in print statement then the compiler interpret it accordingly.

 

Escape Sequence

Let us see the work of following escape sequence-

Escape Sequence Description
t It will insert a tab in the text at this point.
b It will insert a backspace in the text at this point.
f It will insert a formfeed in the text at this point.
n It will insert a newline in the text at this point.
r It will insert a carriage return in the text at this point.
' It will insert a single quote character in the text at this point.
'' It will insert a double quote character in the text at this point.
/ It will insert a backslash character in the text at this point.