Interviews3 answers
Why Java take 2 byte of memory for store character ?
3 Answers
Because it is based on Unicode
Mukesh KumarPosted Sep 2, 2017, 3:30 AM EDT
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.
Munesh SharmaPosted May 4, 2016, 9:30 AM EDT
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.
Taufique SekhPosted Sep 19, 2015, 10:00 PM EDT


