In Java, a set of characters that follow a backslash (\), hold a special meaning for the Java compiler. These are called escape sequences and are used as a shorthand by programmers or to print things like the double quotes (" ") which by itself hold different meanings for the compiler. Escape sequences have to be put in quotes for them to work.
Example in a sentence:
System.out.println("Roses are \'red\',\n\tViolets are \'blue\' ")
gives the output as Roses are 'red',
Violets are 'blue'
You will see below a list of frequently used escape sequences.