What are the Java escape sequences?
Author: Deron Eriksson
Description: This Java tutorial lists the Java escape sequences.
Tutorial created using: Windows XP || JDK 1.6.0_10


The primary JavaSW escape sequences are listed below. They are used to represent non-graphical characters and also characters such as double quotes, single quotes, and backslashes. If you'd like to represent a double quote within a String literal, you can do so with \". If you'd like to represent a single quote within a character literal, you can do so with \'.

Escape SequenceDescription
\bbackspace
\fformfeed
\nlinefeed
\rcarriage return
\thorizontal tab
\'single quote
\"double quote
\\backslash

In addition, octal escapes from \0 to \377 can be represented using escape sequences.

Unicode escapes can be expressed in the form \uXXXX, where \uXXXX represents \u0000 to \uFFFF.