I am actually confused regarding the encoding of strings in Java. I have a couple of questions. Please help me if you know the answer to them:
1) What is the native encoding of Java strings in memory? When I write String a = "Hello"
in which format will it be stored? Since Java is machine independent I don't think the system will do the encoding.
2) I read on the net that "UTF-16" is the default encoding but I got confused because say when I write that int a = 'c'
I get the number of the character in the ASCII table. So are ASCII and UTF-16 the same?
3) Also I wasn't sure on what the storage of a string in the memory depends: OS, language?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…