Java commonly used escape characters

Commonly used escape characters in Java
1) \t: a tab stop, which realizes the alignment function
insert image description here
insert image description here
2) \n newline character
3) \: a \ (the first \ means escape, and the second \ means the output character)
\\: Output two \ (the first \ means escape, the second \ means the output character, the third \ means escape, and the fourth \ means the output character), so the output \ is written as \ \
4)": a "
5)': a'
6) \r: a carriage return System.out.println("My motherland\rChina");
7) \r: carriage return line feed
insert image description here
insert image description here

In the console, enter the tab key to achieve command completion
insert image description here
insert image description here
Classroom exercise:
Requirement: Please use an output statement to achieve the effect of entering the following graphics
insert image description here
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/xiaoxiaoxyxz/article/details/127877472