Home > Java > javaTutorial > What are the Escape Characters Used in Java and How Do They Function?

What are the Escape Characters Used in Java and How Do They Function?

Mary-Kate Olsen
Release: 2024-12-14 22:43:10
Original
822 people have browsed it

What are the Escape Characters Used in Java and How Do They Function?

Escape Characters in Java

Escape characters are used in Java to represent special characters that cannot be represented directly within a string. For example, the newline character (n) is used to create a new line within a string.

Complete List of Escape Characters:

The complete list of escape characters in Java is as follows:

  • t: Insert a tab in the text at this point.
  • b: Insert a backspace in the text at this point.
  • n: Insert a newline in the text at this point.
  • r: Insert a carriage return in the text at this point.
  • f: Insert a formfeed in the text at this point.
  • s: Insert a space in the text at this point.
  • ': Insert a single quote character in the text at this point.
  • ": Insert a double quote character in the text at this point.
  • : Insert a backslash character in the text at this point.

Note: You can also use Unicode escape sequences to represent any character in the Unicode character set. For example, u0041 represents the character 'A'.

The above is the detailed content of What are the Escape Characters Used in Java and How Do They Function?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template