• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt at legal identifier

 
shivdhwaj pandey
Ranch Hand
Posts: 67
Java PHP Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried with $ and pound symbol (not present in my office keyboard) and both were valid identifiers.
 
gurpeet singh
Ranch Hand
Posts: 924
1
Fedora Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic