Why Java char uses UTF-16?
<p>Recently I read lots of things about Unicode code points and how they evolved over time and sure I read <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="noreferrer">http://www.joelonsoftware.com/articles/Unicode.html</a> this also.</p>

<p>But something I couldn't find the real reason for is why Java uses UTF-16 for a char.</p>

<p>For example, If I had the string which contains 1024 letters of ASCII scoped character string. It means <code>1024 * 2 bytes</code> which equals 2KB string memory which it will consume in any way.</p>

<p>So if Java base char would be UTF-8 it would be just 1KB of data. Even if the string has any character which needs to 2bytes for example 10 character of "字" naturally it will increase the size of the memory consumption. <code>(1014 * 1 byte) + (10 * 2 bytes) = 1KB + 20 bytes</code></p>

<p>The result isn't that obvious <code>1KB + 20 bytes VS. 2KB</code> I don't say about ASCII but my curiosity about this is why is it not UTF-8 which just takes care of multibyte chars also. UTF-16 looks like a waste of memory in any string which has lots of non-multibyte chars.</p>

<p>Is there any good reason behind this?</p>