简体   繁体   中英

What form of encoding do you type into System.out.println in Java?

I am trying to learn encoding, so please bear with me.

Using an online encoding tool such as this one , I can see that the data

a
b

can be represented

in Ascii/ANSI as:

a
b

in Hex as:

610d0a62

in base64 as:

YQ0KYg==

But in Java if I need to print this data to the screen I need to use the command

System.out.println("a\r\nb");

What form of encoding is \\r\\n?

In other words, is it fair to say that \\r\\n is the keyboard representation for the ascii

a
b

It's not a real encoding, is an escape character + a character.

It is used to define common ASCII characters which are not printable. The list available to Java is here .

Basically \\r is interpreted as the value 0x0D or 13 in decimal, which is the carriage return.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM