hi: i mfacing a strange problem in comments. ie i have a code public class ali{
//char a='\u00A' } problem: whan i m compiling this code, the code s not compiling. i donot know why the compiler s reading single line coments?
second thing: see this code public class ali{ //int a= 2; //byte b= 2; //float f= 2; //double d=2; //in all other cases compiling } problem 2: when i mcompiling this code , it compile successfully. plz explain the difference of these two problems. thxs bybyby love to all
Hima Mangal
Ranch Hand
Joined: Feb 25, 2001
Posts: 82
posted
0
hi sony, i think this is because the escape sequence '\u000A' stands for a special character, that is the carriage return character so that ur code char c='\u000A'; is equivalent to char c= ; that is, the compiler performs the unicode conversion while compiling and results in compiler error. pls correct me if i am wrong. ------------------ Hima
Hima<BR>Sun Certified Java Programmer
Naveed Hassan
Greenhorn
Joined: Feb 23, 2001
Posts: 17
posted
0
Hi but why the compiler is not ignoring the rest of the line by finding comment symbol==> // on the start of the line BYe
sony ali
Greenhorn
Joined: Feb 24, 2001
Posts: 9
posted
0
hi : hina mangal actully my question s that as we know that "when a line having single line comments . it s not read by the compiler". so why here the compiler is reading this (//char a= \u000A)explain me.
Paul Anilprem
Enthuware Software Support
Ranch Hand
Joined: Sep 23, 2000
Posts: 2912
posted
0
The reason is such unicode escape sequences are converted to appropriate characters in "pre" compilation step. It's true that the compiler won't look at anything after // in that line, but //char a='\u00A' is converted to: //char a=' ' even before the compiler starts working on it. HTH, Paul.