Languages
[Edit]
EN

Java - escape sequences

0 points
Created by:
daniell
490

In this article, we would like to show you escape sequences in Java.

Escape sequenceDescription
\nInserts a new line.
\tInserts a tab.
\bInserts a backspace.
\rInserts a carriage return.
\fInserts a form feed.
\"Inserts a double quote character.
\\Inserts a backslash.

 

Practical examples

Edit

Example 1

Edit

In this example, we use \\ escape sequence to insert backslash into the path String.

Output:

Example 2

Edit

In this example, we use \n escape sequence to insert a new line between the words.

Output:

Example 3

Edit

In this example, we use \" escape sequence to insert a double quote character.

Output:

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - String documentation

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join