File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt at legal identifier" Watch "doubt at legal identifier" New topic

doubt at legal identifier

shivdhwaj pandey
Ranch Hand

Joined: Nov 12, 2011
Posts: 67

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

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

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.
IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
IdentifierChars JavaLetterOrDigit
any Unicode character that is a Java letter (see below)
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

Joined: Oct 14, 2005
Posts: 19973

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

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.
I agree. Here's the link:
subject: doubt at legal identifier
It's not a secret anymore!