About Lesson
Example of Escape Sequence
Example:
public class EscapseSequenceExample {
public static void main(String[] args) {
System.out.println("Hello!nwelcome to programming world");
System.out.println("t'Programming' is fun");
System.out.println("\"Java"is on of the best programming language.\");
}
}
Console Output:
List of Escape Sequences :
There are many types of escape sequence that we use in java. Some of them are discussed are:
n:Â Â This escape sequence is used to define a new line. So that we not need to write System.out.print again and again.
Example:
System.out.println(""javanisnanninterestingnlanguage"");
Output:
t: This escape sequence is used print tab in console.
Example:
System.out.println("Hi!");
System.out.println("tthere");
Output:
“:  We use this character to give double quotation.Â
Example
System.out.println(""hello world"");
Output:
//: This charcter is used to print a backslsh on text string.
Example:
System.out.println("Programming\fun");
Output: