This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt at legal identifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt at legal identifier" Watch "doubt at legal identifier" New topic
Author

doubt at legal identifier

shivdhwaj pandey
Ranch Hand

Joined: Nov 12, 2011
Posts: 63

in scjp6 book by k&b at page no 5 at legal identifiers ,
there is a statement regarding types there is a confusion it says
"currency symbols"
does it mean we can use any currency symbol?


with regards,
Shivdhway Pandey
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
I have tried with $ and pound symbol (not present in my office keyboard) and both were valid identifiers.
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

from the JLS 3.8 identifiers

3.8 Identifiers
An identifier is an unlimited-length sequence of Java letters and Java digits, the
first of which must be a Java letter.
Identifier:
IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
IdentifierChars:
JavaLetter
IdentifierChars JavaLetterOrDigit
JavaLetter:
any Unicode character that is a Java letter (see below)
JavaLetterOrDigit:
any Unicode character that is a Java letter-or-digit (see below)
A "Java letter" is a character for which the method
Character.isJavaIdentifierStart(int) returns true.
A "Java letter-or-digit" is a character for which the method
Character.isJavaIdentifierPart(int) returns true.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

shivdhwaj pandey wrote:does it mean we can use any currency symbol?


"Currency symbol" refers to any character which Unicode describes as a currency symbol. In other words for which



returns true.
Erandika Withanage
Greenhorn

Joined: Apr 08, 2011
Posts: 14

Just a small question here: when the book says connecting characters, what other than the underscore "_" can be used as an underscore?

I've tried dash "-" and it gives an error.
 
Don't get me started about those stupid light bulbs.
 
subject: doubt at legal identifier
 
Similar Threads
SCWCD Study Companion Availability
illegal identifier
Sale of SCJP 1.5 Voucher
Easy question about connecting characters
why $ only ???