File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes chars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "chars" Watch "chars" New topic


khella smith
Ranch Hand

Joined: May 06, 2002
Posts: 39
i need some help i am getting confused with this char initialization how come u can have this '\u000b','\u0a00','\uface'etc but u can't have '\u000a'?
i don't get it pls explain to me
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
If you look at the Unicode Chart you will see that:
\u000A is a linefeed
\u000B is a vertical tab
\u000C is a form feed (page separator)
\u000D is a carriage return
Then you need to remember that when handling your code the compiler
-first converts all the typed characters to unicode,
-second DOES all the unicode commands
-third starts looking at your code to begin compiling it.
Well if you have a \u000a in the middle of a line of code the linefeed is going to happen before any compiling occurs. The effect is that the line will be split into 2 logical lines as far as the compiler is concerned and you will get syntax errors for not completing whatever command that you were doing.
The other unicode expressions are just characters that are not print commands and therefore do not muddle up your syntax.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: chars
It's not a secret anymore!