why this is valid? float f= \u0038 I thought the right way should be float f= 'u0038' the explanation is that \u0038 is unicode for nbr 8. what does that mean?
posted 13 years ago
You can read more about Unicode in the JLS, §3.10.4 Character Literals. In short, Unicode format encapsulates all characters in the World, unlike ASCII. When you compile a Java program, Unicode characters are translated very early in the process. Therefore, when it actually came time to compile that code, the compiler would see the line:
This is obviously valid. Of course, had we put tick marks around it, we would have ended up with this:
This is also legal, but it's also quite different. The number 8 and the character value of the number 8 are not one in the same. I hope that helps, Corey [ June 06, 2002: Message edited by: Corey McGlone ]