Introduction to escape characters in Java

  • 2020-04-01 02:15:59
  • OfStack

There are four types of escape characters in Java:

Escape characters in JAVA:

1. Octal escape sequence: + 1 to 3 5 digits; Range '00' ~ '377'
: null character

2.Unicode escape characters: u + four hexadecimal digits; 0 ~ 65535
U0000: null character

3. Special characters: just three
": double quotation marks
': single quotation marks
\ : backslash

4. Control characters: 5

R the enter
N a newline
F go to the page
T cross jump
B backspace

Rules for using these escape characters: regular escape character sequences and octal escape characters are much better than Unicode escape characters because, unlike Unicode escape characters, escape character sequences are processed after the program has been resolved into various symbols. Unicode escape characters can cause confusion because they are processed too early in the compiled sequence. In general, escape character sequences are preferred in strings and literal character constants, not Unicode escape characters.


Related articles: