Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

char assignment

 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am new in this forum and have a basic question.
Why this code does not compile?

Thanks for your help.
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although this question is more frequently asked in the SCJP forum, when I did a search in this forum (using \u000A) I found several including:

this one with the following response
Originally posted by Mike Gershman:
If you put '\u000a' or '\u000d' in a source program, the compiler treats it as an actual line break in your program text and breaks your statement into two lines, both of which will probably have a syntax error.

You need to use '\n' or '\r'.


and these which may clarify further if you want more detail:

http://www.coderanch.com/forums/

http://www.coderanch.com/t/390266/java/java/Invalid-Chararcter-constant

http://www.coderanch.com/t/389165/java/java/uni-code
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic