Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

identifiers  RSS feed

 
thiru chakaradhar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the significance of the symbol # in java?
Does it have any special meaning becuz it is illegal to use in identifiers.
Like in C does this symbol hold any special value or meaning in java.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

Java identifiers are fairly restricted in the characters they can use. These are specified in Section 3.8 of the Language Specification...
An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter...

The Java letters include uppercase and lowercase ASCII Latin letters A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $ character should be used only in mechanically generated source code or, rarely, to access preexisting names on legacy systems.

The "Java digits" include the ASCII digits 0-9 (\u0030-\u0039).

I don't know of a special use of the '#' character in the Java language itself (i.e., the Language Specification), although it can have special significance in API classes like java.util.Formatter.
[ August 24, 2007: Message edited by: marc weber ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!