Good programmers Java tutorial share common escape characters in Java character constants, the backslash ( \ ) is a special character, called the escape character, its role is to escape behind a character. After the escape character is used to indicate a generally invisible character or characters have a special meaning, e.g. linefeed ( \ n- ).
Here are some common escape character.
\ r represents a carriage return, the cursor to the beginning of the current line, next line does not.
\ n represent a newline character, change to the beginning of the next line.
\ t denotes a tab character, the cursor moves to the next position of a tab, as in the document using Tab the same key.
\ b represents the backspace symbol, just like on the keyboard Backspace key.
Java following characters has a special meaning, it can not be directly represented, so with another backslash character to represent.
\ "Represents a single quote character, the Java code represents the single quote character to begin and end, if you write a single direct quote character ( ' ), the program will think the first two are a pair, will complain, so need to use the escape character" \ '. "
\ " Represents the double-quote character, the Java code and double quotes indicate the start and end of the string, the string contained in double quotes need to escape, such as ( hesays, \ " thankyou \ " . ).
\\ identify the backslash character, because the Java backslash code ( \ ) is the escape character, and therefore need to represent literal \ , you need to use a double backslash ( \\ ).