Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Many classes allow inclusion of escape sequences in character and string literals; examples include java.util.regex.Pattern as well as classes that support XML- and SQL-based actions by passing string arguments to methods. According to the Java Language Specification §3.10.6, "Escape Sequences for Character and String Literals" [JLS 2011],

The character and string escape sequences allow for the representation of some nongraphic characters as well as the single quote, double quote, and backslash characters in character literals (§3.10.4) and string literals (§3.10.5).

...

Incorrect use of escape characters in string inputs can result in misinterpretation and potential corruption of data.

Bibliography

...