Which of the following encoding schemes is used by the jvm internally for storing identifiers, etc? a) Unicode b) UTF8 c) ASCII d) 8859-1 e) it depends on the platform The listed answer is b, but I was almost certain the answer was a. If a is not the right answer, why not?
Well ! for certification u must keep in mind that INTERNALLY the JVM stores as UTF8, the reason being the universality of the UTF as the name suggests. And by the way jsy start believing JQ+ as it is the best tool for certification.
Joined: Jan 22, 2001
Thanks for your reply Fawad. However I'm still a little confused. In Mughal's book (pg. 567) it says, "Java programs represent characters internally in the 16-bit Unicode character encoding, but the host platform might use another character encoding to represent characters externally." To me, this is saying that Unicode is used internally. Am I not understanding this quote correctly?
Internally Java uses UTF8 for string literals, identifiers etc because this format is more compact. Unicode chars always require 2 bytes to store any char but UTF8 takes only 1 byte to store standard ASCII chars. HTH, Paul.