Why does the Java char primitive take up 2 bytes of memory?

后端 未结 7 626
有刺的猬
有刺的猬 2020-11-30 03:38

Is there any reason why Java char primitive data type is 2 bytes unlike C which is 1 byte?

Thanks

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

    Java™ Tutorials:

    The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

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