0

I am reposting this question.
How many bytes in memory a string occupy in Java language?
Suppose i write:
String name="Bill Gates";
So, how much memory it requires? Whether it can store a UNICODE character in the string. How internally it is implemented, using a 1 byte char array or 2 byte unicode char array? I read somewhere that Java's char data type is 16 bit wide.

Thanks!!!

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by verruckt24
0

Java uses Unicode for internal character representation which is 2 bytes or 16 bit wide. So basically each character uses 2 bytes of memory.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.