• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About Comment line "//"

 
Ranch Hand
Posts: 107
MyEclipse IDE Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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...
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get no compiler error when I try your code.

What is the exact text of the error you are getting?
 
Prakash Rai
Ranch Hand
Posts: 107
MyEclipse IDE Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 107
MyEclipse IDE Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 107
MyEclipse IDE Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 13089
67
Chrome Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 107
MyEclipse IDE Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks fred rosenberger.. I too understand same concept...
 
reply
    Bookmark Topic Watch Topic
  • New Topic