File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

strange doubt challenging

 
Praveen Seluka
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I remember I came across a character even if present in the comment will not let the program compile.
i mean
void doi()
{
//some character here(inside comment)
}

I am sure there is one character But I dont know what.
If I get to know, I will post in my blogs as the most strange question

any help
 
Sagar Rohankar
Ranch Hand
Posts: 2904
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some time ago when I copy pasted a code from internet, my JDk 1.6 raise an warning , the character are non ASCII and commented !!

I don't know whether its Netbeans IDE problem or JDK, I simply remove them and not pursue it further ..

This links discussed what you say !
 
Praveen Seluka
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks for the reply
I came across a valid ascii character I believe
 
Sagar Rohankar
Ranch Hand
Posts: 2904
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you believe its a ASCII character only , then better way you check each and every character from 0 to 127.

here is the table.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More of a beginner's question.

Java is Unicode compliant; you ought not to have any problems with any sort of characters. Please always post the actual code so we can see what it is. You might in fact have a completely different compiler error.

What sort of comment is it? Does it start with /*? If so, any */ anywhere in the comment will convert the rest of the comment to what the compiler sees as nonsense.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats a classic - Unicode is translated as the source is read. A unicode linefeed will cause the // comment to be split, probably producing a following line of illegal code and a compiler error.

Bill
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, of course, a line end character after a // would behave rather similarly to a */
And it might even have different effects on different operating systems, if you are really unlucky!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic