What exactly is the concept of a char-type code unit in java?

What exactly is the concept of a code unit of type char?

recently, I saw "java Core Technology Volume 1 (10th Edition)" and encountered the concept of code unit in Section 3.6.6. There was some confusion

.

related codes

String sentence= "11 is the set of octonions";
System.out.println (sentence.charAt (1));

)

according to "java Core Technology Volume 1" (Section 3.6.6), the console output should be the second code unit of "11", but the result of my own test is the output space, which is contrary to what the book says. What"s going on?

Aug.16,2021

your symbol is mistyped. What should be the correct one? Instead of 11


char is 2 bytes in java

Menu