Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in Literals

 
Pallavi ch
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compiler interprets \u000a as a line terminator. The escape sequence \n should be used instead.
Similarly, \u000d is interpreted as a line terminator. The escape sequence \r should be used instead.

what does this mean??
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means suppose u have a declaration like
char a = '\u000a';

The compiler interprets it as
char a = ;
Same applies for '\u000d'

which is obviously a compilation error
 
Pallavi ch
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
S it's compilation error.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"lavanyapmr "-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
ankur rathi
Ranch Hand
Posts: 3830
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
char a = '\u000a';

I think the compiler will interpret it like this :

char a = '
';

And thatswhy it gives compile time error .

please correct me if I am wrong ...

Thanks .
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess u right,
because its a new line
anyways, whatsoever we get a compiler error
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic