This program gave 62 errors when compiled with command prompt, all of them were illegal expression. I saved the file in UNICODE format.
But when I compiled it using NetBeans there were no errors and the output was 5 , 5 instead of 5 , 6.
The symbol ♭ is represented by two code units or code points?
Whats the difference between code oints and code units?
What is surrogate area?
The program ran first time on my terminal and printed 5 , 5.
To find out the ♭ symbol, you would have to go to the Unicode Index and look up “flat”; if it is ≤ 0xffff then it is one code point.
Sagar Dabas wrote:Can we store supplementary characters in char type
No, but Java Strings can handle supplementary characters as a "surrogate pair". I suggest you look at the documentation for java.lang.Character, and particularly the isHighSurrogate() and isSurrogatePair() methods. This page also contains a glossary of useful terms.
Winston
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here