AP® Computer Science A glossary

Escape sequence

Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods

A special sequence of characters in a string that starts with a backslash: \" (double quote), \\ (backslash) or \n (newline).

Appears in the course and exam description (CED): 1.3.B.3

An escape sequence lets a string contain a character that is hard to type inside quotes. The course uses three: \", \\ and \n. Each one counts as one character.

System.out.println("She said \"go\"\nC:\\temp");

Output:

She said "go"
C:\temp
Learn it properly, with a checkpoint 1.3 Expressions and Output

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure