Java Escape Sequences With Program Example

A character went before by an oblique punctuation line () is known as an escape sequence.

There are all out 8 escape sequences in Java which have unique importance to the compiler.

At the point when we utilize an escape sequence in print explanation then the compiler translates it as needs be. All the escape sequences with the program model are given underneath.

Java Escape Sequences Example

Escape Sequence Description
t It will insert a tab in the text at this point.
b It will insert a backspace in the text at this point.
n It will insert a new line in the text at this point.
r It will insert a carriage return in the text at this point.
f It will insert a formfeed in the text at this point.
It will insert a single quote character in the text at this point.
It will insert a double quote character in the text at this point.
class EscapeSequences
{
 public static void main(String...s)
 {
  System.out.print("tThe Crazy Programmer");
  System.out.print("nThe Crazy Programmer");
  System.out.print("nThe bCrazy Programmer");
  System.out.print("nThe Crazy Programmerr");
  System.out.print("'The Crazy Programmer'");
  System.out.print("n"The Crazy Programmer"");
  System.out.print("nfThe Crazy Programmer");
  System.out.print("nThe Crazy Programmer");
 }
}  

Output

Java Escape Sequences With Program Example

Leave a Comment

error: Alert: Content is protected!!