The escape() method will be used to invert the escapes. The following table shows how it will convert the characters:
Original character |
Converted character |
Less than ' ' (space) |
Unicode or character escape sequences |
Above ~ (tilde) |
Unicode escape sequences |
" (double quotes) |
Escape sequence |
' (single quote) |
Escape sequence |
(backslash) |
Escape sequence |
The following example doesn't include a newline in the output:
System.out.println("eJava" + " ".escape() + "Guru");
The output of the preceding code is as follows:
eJava Guru
Consider the following code:
System.out.println("eJava" + `•`.escape());
The output of the preceding code is as follows (• is converted to its equivalent escape value):
eJavau2022Guru