Start Coding Now

Java Escape Sequences - Special Characters

List of escape sequences in Java strings. Learn how to print quotes, newlines, and backslashes.

Common Escape Sequences

Used to print special characters inside Strings.

SequenceDescription
\nNew Line
\tTab
\"Double Quote
\'Single Quote
\\Backslash

Example

System.out.println("Hello\nWorld"); 
// Prints:
// Hello
// World

System.out.println("She said \"Yes\""); // Prints: She said "Yes"

Frequently Asked Questions