Computer Science, asked by tusharkashyap37, 1 year ago

why char in c have 1 byte while in java it has 2 bytes​

Answers

Answered by kiranramzan996
0

Answer:

Explanation:

In old languages like C and C++ we can use only ASCII characters and to represent all ASCII characters 8-bits are enough. Hence char size is 1 byte.

But in Java we can use Unicode characters which covers world wide all alphabets sets. The number of Unicode characters is greater than 256 and hence 1 byte is not enough to represent all characters. Hence we should go for 2 bytes.

Hope this will helps you.

Similar questions