| Author |
About Comment line "//"
|
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
Q1. If I have commented then also why it is giving error.If have commneted then it is supposed not to read by compiler So their is no question What I have written?
Q1.If I have enclosed within double quote("") It should consider as String?
Please Help me as soon as possible.....
Thanks in advance...
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9948
|
|
I get no compiler error when I try your code.
What is the exact text of the error you are getting?
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
fred rosenberger wrote:I get no compiler error when I try your code.
What is the exact text of the error you are getting?
Error:
Multiple markers at this line
- String literal is not properly closed by a
double-quote
- Invalid unicode
|
 |
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
fred rosenberger wrote:I get no compiler error when I try your code.
What is the exact text of the error you are getting?
Error:
Multiple markers at this line
- String literal is not properly closed by a
double-quote
- Invalid unicode
|
 |
John Jai
Bartender
Joined: May 31, 2011
Posts: 1778
|
|
I even tried it from the cmd prompt and got below error.
Test.java:7: illegal unicode escape
// String str="c:\program\user"; Error Invalid unicode "
^
1 error
|
 |
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
John Jai wrote:I even tried it from the cmd prompt and got below error.
Test.java:7: illegal unicode escape
// String str="c:\program\user"; Error Invalid unicode "
^
1 error
yeah correct but after commenting also it is giving error why ?
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9948
|
|
My mistake...i was not compiling what i thought i was.
my guess is that this is due to the unicode conversion that happens before much else. Even though it is a comment, something is trying to make it unicode, so the "\u" is being read as a unicode reference.
If you change the comment line to something like
// String str="c:\program\puser"; Error Invalid unicode
it compiles.
|
 |
Prakash Rai
Ranch Hand
Joined: Jan 10, 2011
Posts: 101
|
|
|
Thanks fred rosenberger.. I too understand same concept...
|
 |
 |
|
|
subject: About Comment line "//"
|
|
|