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

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

Barbara Streisand
Release: 2024-12-18 00:53:10
Original
534 people have browsed it

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

Escape Characters in Java

Java utilizes various escape characters to represent special characters or specific actions within a string. While you may be familiar with a few, such as n for newline, there are several more that are useful for various purposes.

Complete List of Escape Characters:

According to the official documentation, the following is a comprehensive list of escape characters supported in Java:

  • t: Inserts a tab character
  • b: Inserts a backspace character
  • n: Inserts a newline character
  • r: Inserts a carriage return character
  • f: Inserts a formfeed character
  • s: Inserts a space character
  • ': Inserts a single quotation mark
  • ": Inserts a double quotation mark
  • \: Inserts a backslash character

The above is the detailed content of What are the Escape Characters Used in Java and What Do They Do?. 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