What are all the escape characters?

izb picture izb · Sep 2, 2009 · Viewed 486.1k times · Source

I know some of the escape characters in Java, e.g.

\n : Newline
\r : Carriage return
\t : Tab
\\ : Backslash
...

Is there a complete list somewhere?

Answer

rtperson picture rtperson · Sep 2, 2009

You can find the full list here.

  • \t Insert a tab in the text at this point.
  • \b Insert a backspace in the text at this point.
  • \n Insert a newline in the text at this point.
  • \r Insert a carriage return in the text at this point.
  • \f Insert a formfeed in the text at this point.
  • \' Insert a single quote character in the text at this point.
  • \" Insert a double quote character in the text at this point.
  • \\ Insert a backslash character in the text at this point.