unicode character is represented by '\uxxxx'.......where xxxx is a hexadecimal no.i get an error in the following assignment
1. '\Uxxxx' replacing u with U 2. '\u000a' 3.'\u000d' 4.'\u4e' isn't 004e same as 4e, both are hex no..... or is it like the hex no should be rep by 4 digit in unicode no. [ February 22, 2005: Message edited by: cybel sheriden ]
Hmmm...I tried to post a reply to your other message but it looks like someone deleted it. However, with the risk of confusing people, I'll still post my answer here. It might help to alleviate the confusion if you edit the above message. (Of course, you may be doing that at this exact moment...I guess we'll just see.) Without any further ado, here's my answer to your question:
In programming, 004e is NOT the same as 4e. The difference is in the amount of space that is used. Since each hexadecimal digit is equivalent to 4 binary digits (or bits), 4e only takes 8 bits or 1 byte whereas 0043 takes up 16 bits or 2 bytes.
thanks Layna......i got the answer for the 4th case of my listing wht abt the first three cases, which i got error.
posted 15 years ago
I'm not sure what the problem is for the first three. What error are you referring to? Are you talking about a compiler error? If you are compiling some sample code to investigate this, please post the code as well as the compiler error you recieve.
Also, please take the time to type out full words. Many of our members speak and write English as a second (or third or fourth language). Abbreviations can be confusing, even for native English speakers. So please type out complete words like "number" rather than using abreviations like "no".
test1.java:7: illegal line end in character literal char a='\u000d'; ^ test1.java:8: illegal line end in character literal char b='\u000a'; ^ test1.java:9: illegal escape character char c='\U004e'; ^ test1.java:9: unclosed character literal char c='\U004e'; ^ test1.java:9: unclosed character literal char c='\U004e'; ^ test1.java:10: ';' expected ^ 6 errors
If you put '\u000a' or '\u000d' in a source program, the compiler treats it as an actual line break in your program text and breaks your statement into two lines, both of which will probably have a syntax error.
You need to use '\n' or '\r'.
SCJP 1.4, SCWCD in process
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF