I would like to know what all the backslash commands are when printing something in Java.
I think \b
is backspace.
I think \n
is next line.
I don't know any others and would like to more.
Asked
Active
Viewed 1,403 times
-3

Ram Bhagat
- 1
- 2
-
this is called escape characters.. you can read this post as a reference https://stackoverflow.com/questions/1367322/what-are-all-the-escape-characters – jackycflau Dec 23 '19 at 02:48
-
4Does this answer your question? [What are all the escape characters?](https://stackoverflow.com/questions/1367322/what-are-all-the-escape-characters) – D M Dec 23 '19 at 03:14
-
These are all documented in the Java Language Specification. Any answer you get on the Internet, including here, can only be as good as the JLS, and you run the risk of it being a great deal worse. For example, the answer below here is incomplete. Don't ask questions about things you can look up for yourself. – user207421 Dec 23 '19 at 06:27
1 Answers
0
\t
Insert a tab in the text at this point.
\b
Insert a backspace in the text at this point.
\n
Insert a newline in the text at this point.
\r
Insert a carriage return in the text at this point.
\f
Insert a formfeed in the text at this point.
\'
Insert a single quote character in the text at this point.

Hasan
- 1,243
- 12
- 27

Chandan Pradhan
- 9
- 1
-
Pardon me, but I fail to see how your answer adds anything to the linked answer in [jackycflau](https://stackoverflow.com/users/5348990/jackycflau)'s comment to the original question. – Abra Dec 23 '19 at 02:54
-