Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the difference between' 8' and 8 description in java language?
What is the difference between' 8' and 8 description in java language?
The "8" in single quotation marks is a char character, which is encoded in unicode in java and has a length of 2 bytes. The code position of "8" is 56.

8 is a number, not an integer. In java, by default, integers are stored with int type, and the length of int type is 4 bytes.

And if it is "8" in double quotation marks, it is a string constant (also called literal quantity or direct string quantity). In java, a String is an object like String, and a string is an immutable object.