The escape() method

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 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.107.254