This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes identifier name Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "identifier name" Watch "identifier name" New topic
Author

identifier name

Ajay Kumar Rana
Greenhorn

Joined: Feb 27, 2008
Posts: 13
Hi,
I have typed this statement in eclipse

char \u0061 = �a�;

and it is not giving any error . But it has to give error because the identifier name is starting with "\" which is illegal, please give me explanation about this identifier naming.
Amir Alagic
Ranch Hand

Joined: Mar 21, 2006
Posts: 65
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/variables.html

http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12928
    
    3

I think Ajay already understands what characters you can use in a variable name.

In Java source code, you can use Unicode escape sequences that look like \uNNNN where NNNN is the four-digit hexadecimal code of the character. These escape sequences are processed by the Java compiler as the very first step in the compilation process. Because of this, you can use an escape sequence in the place of a normal character.

Character 0061 is the lower case a. So

char \u0061 = 'a';

is exactly the same as:

char a = 'a';

You could even go further. Do you understand what the following line of code is?

\u0063\u0068\u0061\u0072\u0020\u0061\u0020\u003d\u0020\u0027\u0061\u0027\u003b
[ February 28, 2008: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: identifier name
 
Similar Threads
A Query....
leagal identifiers
JDBC Help figuring it out
identifying identifiers
img tag under a table row