This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are the valid identifiers in the code given?

 
kishor kotecha
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the valid identifiers in the following?
Select all valid answers or none.
a. char a = 'a';
b. char \u0061 = 'a';
c. ch\u0061r a = 'a';
All are correct!!! Surprised at b & c are correct?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason being that Unicode gets translated during the reading of a line, so the compiler sees a translated String.
This is the reason you can't use the Unicode representation for carriage-return and new-line in Strings - they get translated into a line end when the compiler reads the source.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic