Why Java take 2 byte of memory for store character ?
Taufique Sekh
Because of Unicode character
java follows unicode strings
Because it is based on Unicode
because it uses unicodes
The Java char datatype is 16 bit, byte is 8 bit.This is because Java Strings are unicode Strings, not ASCII ones allowing standard Java Strings to be used in most languages worldwide.
Java support more than 18 international languages so java take 2 byte for characters, because for 18 international language 1 byte of memory is not sufficient for storing all characters and symbols present in 18 languages. Java supports Unicode but c support ascii code. In ascii code only English language are present, so for storing all English latter and symbols 1 byte is sufficient.