• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comment...?

 
Kedar Dravid
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why doesn't the following compile?
public class AQuestion
{
public static void main(String args[])
{
//char a = '\u000A';
}
}
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java compiler can't tell the difference between the '\u000A' in your program and an actual end of line in your code. It sees your source program as:


Instead, use '\n'
[ November 30, 2004: Message edited by: Mike Gershman ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Mike meant to type was:


 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason for this is that Unicode characters get translated on the fly as the source code file is being read and before the compiler sees them.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic