Adding char and int

前端 未结 7 2053
梦如初夏
梦如初夏 2020-11-30 10:51

To my understanding a char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar. And therefore when I do:

相关标签:
7条回答
  • 2020-11-30 11:34

    'char' is really just a two-byte unsigned integer.

    The value '1' and 1 are very different. '1' is encoded as the two-byte value 49.

    "Character encoding" is the topic you want to research. Or from the Java language spec: http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.2.1

    0 讨论(0)
提交回复
热议问题