aspose file tools*
The moose likes Java in General and the fly likes About Comment line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "About Comment line "//"" Watch "About Comment line "//"" New topic
Author

About Comment line "//"

Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106


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: 11499
    
  16

I get no compiler error when I try your code.

What is the exact text of the error you are getting?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Prakash Rai
Ranch Hand

Joined: Jan 10, 2011
Posts: 106

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: 106

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: 1776
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: 106

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: 11499
    
  16

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: 106

Thanks fred rosenberger.. I too understand same concept...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Comment line "//"