Is there any reason why Java char primitive data type is 2 bytes unlike C which is 1 byte?
Thanks
Is there any reason why Java char primitive data type is 2 bytes unlike C which is 1 byte?
Thanks
Java uses UNICODE (Universal Code) representation which accepts all the language formats in the world.
ASCII American Standard Code for Information Exchange
ISO 8859-1 for western European Countries
KOI-8 for Russian
GB10830 & BIG-5 for Chinese
In this 1 byte is reserved for ASCII & remaining 1 byte can accept any other language => 2byte for char
while C/C++ uses only ASCII Representation => 1 byte for char