Introduction to escape characters in Java

There are four 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 character: U + four hexadecimal digits; 0 ~ 65535 u0000: null character

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

4. Control characters: 5

R enter N line feed f paper feed t horizontal skip B backspace

Rules for using these escape characters: ordinary 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 is parsed into various symbols. Unicode escape characters can cause confusion because they are processed too early in the compilation sequence. In short, the escape character sequence is preferred in string and character literal constants, rather than Unicode escape characters.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>