Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the concept of java escape character and how to use it

Shulou Source: shulou.com Published: 2022-05-31 10:52:36 09月20日 Update

This article "java escape character concept is what and how to use" most people do not understand, so the editor summarized the following content, detailed, clear steps, with a certain reference value, I hope you can get something after reading this article, let's take a look at this "java escape character concept is what and how to use" article it.

1. Concept

There are some characters in java that have a special function, and if you want to represent the character itself, you can use escape characters if you don't want to represent a special function.

2. Use

Escape characters start with\

\ t Tabs: one tab position represents 8 spaces

If the previous content satisfies an integer multiple of the tab position, re-open a tab bit with 8 spaces

If the previous content is not satisfied, the whole tab bit is not complete.

\ nWrap

\ b cursor backspace

\ r the cursor goes back to the beginning of the line

3. Examples

Escape character in / * java * / public static CharTest02 {public static void main (String [] args) {char C1 ='t escape; System.out.println (C1) / / according to what you have learned, the following code should report an error: / / after testing, the following code can be compiled, so the following code "\ t" / / is actually a character, does not belong to the string / / two words match together to represent a character, where\ t next to the "tab" char c2 ='\ t' System.out.println ("abc\ tdef"); System.out.println ("HelloWorld"); System.out.print ("HelloWorld") / / "\" will be escaped next to the following characters}} the above is about "what is the concept of java escape characters and how to use" this article, I believe we all have a certain understanding, I hope the content shared by the editor will be helpful to you, if you want to learn more about the relevant knowledge, please follow the industry information channel.

Tags: Characters content escape tabs tabs concepts codes special location functions cursors articles knowledge spaces articles two representatives values can be passed most Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Xiaomi Shulou Tech Info Shulou Technology vpn