MathBits.com
Return to Unit Menu |  Java Main Page | MathBits.com | Terms of Use  | Java Resource CD  

Escape Sequences

The following is a table of escape sequences to be used when printing in Java.
These statements are embedded within a literal print remark (they go between the quotes):

Sequence Name Meaning
\n New line Moves to beginning of next line
\b Backspace Backs up one character
\t Horizontal tab Moves to next tab position
Tab spacing is every 8 columns starting with 1.
(Columns 9, 17, 25, 33, 41, 49, 57, 65, 73 ...)
\\ Backslash Displays an actual backslash
\' Single quote Displays an actual single quote
\" Double quote Displays an actual double quote

System.out.println("\tGeorge\t\tPaul");

will tab, print George, tab twice more, and print Paul.

                                                                                                              


Return to Unit Menu | Java Main Page | MathBits.com | Terms of Use  | Java Resource CD