Java Escape Sequences With Program Example

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. All the escape sequences with program example is given below.

Java Escape Sequences With Program Example

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.
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.
f
It will insert a formfeed 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.

Java Escape Sequences With Program Example

Leave a Reply

Your email address will not be published. Required fields are marked *