Escape Sequence
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:

Display a test ad
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare
Alert: You are not allowed to copy content or view source !!