aspose file tools
The moose likes Java in General and the fly likes About Comment line Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "About Comment line "//"" Watch "About Comment line "//"" New topic
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
    
    6

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
    
    6

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Comment line "//"
 
Similar Threads
method calling a method????- Am I Right???
about static
html radio button add to database
math program help..
equals override: 2