This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes comment problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "comment problem" Watch "comment problem" New topic
Author

comment problem

anup sachan
Greenhorn

Joined: Jan 16, 2007
Posts: 11


When i am compiling this progam ,i am getting compiler error:illegal character assignmment ,even though i have commented that line in the code.Can anyone tell me why it happens so.
Raji Rama
Greenhorn

Joined: Jan 16, 2007
Posts: 5
take out the quotes.it works...

can anyone say why it happens???though it is commented.


public class t
{
//char a = \u000A;
}
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
The problem is that those UNICODE character escapes are processed before the
code is parsed.

So to the compiler the code looks like this.



This is from the Java Language Specification 3.10.4.

Because Unicode escapes are processed very early, it is not correct to write '\u000a' for a character literal whose value is linefeed (LF); the Unicode escape \u000a is transformed into an actual linefeed in translation step 1 (�3.3) and the linefeed becomes a LineTerminator in step 2 (�3.4), and so the character literal is not valid in step 3. Instead, one should use the escape sequence '\n' (�3.10.6). Similarly, it is not correct to write '\u000d' for a character literal whose value is carriage return (CR). Instead, use '\r'.
[ January 16, 2007: Message edited by: Keith Lynn ]
anup sachan
Greenhorn

Joined: Jan 16, 2007
Posts: 11
thanks i gotit.
[ January 16, 2007: Message edited by: anup sachan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comment problem
 
Similar Threads
Adding checkbox in table column
q on strings
Constructor call
Doubt in Sun's 1.4 Practice xam
exception catch