CopyPastehas never been so tasty!

Escape Sequence Characters in java

by anonymous

  • 0
  • 0
  • 0
66 views

Escape Sequence Characters in java

Escape Sequence:Escape sequences are special character with backslash. They have some special meaning that compiler can understand. There are many type of escape sequence.For example:

    
\t     tab 

\b     backspace 

\n     newline 

\r     carriage return 

\'     single quote 

\"     double quote 

\\     backslash

 purposes Of Escape Sequences:

 \t          It is used to Insert a tab in the text at some point.

 \b         It is used to Insert a backspace in the text at some point.

 \n         It is used to Insert a newline in the text at some point.

 \r           It is used to insert a carriage return in the text at some point.

 \f          It is used to Insert a form feed in the text at some point.

 \'          It is used to Insert a single quote character in the text at some point.

 \"          It is used to insert a double quote character in the text at some point.

 \\          It is used to Insert a backslash character in the text at some point.

 When an escape sequence is to be used in a print statement, the compiler interprets it according to it.For example, if you want to put quotes within quotes you must use the escape sequence, \" to print the sentence

He said "Bye!" to me.

 you have to write System.out.println("He said \"Bye!\" to me."); 

This simple article is about escape sequence characters in Java.

Add A Comment: