permaculture playing cards*
The moose likes Beginning Java and the fly likes java keyword  as a legal identifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java keyword  as a legal identifier" Watch "java keyword  as a legal identifier" New topic
Author

java keyword as a legal identifier

ashu s
Greenhorn

Joined: Feb 12, 2001
Posts: 8
Can java keywords consider as alegal identifier?
consider this e.g.
a. number
b. 12color
c. abstract
can somebody tell me where abstract is legal keyword or not?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

ashu,
a. number is the only legal identifier in your list...
b. 12color starts with a number (which Java begins parsing as a numeric literal), so it is not a legal identifier.
c. abstract is a reserved word (as in public abstract class someClass), so it is not a legal identifier either.
Legal identifiers can consist of upper and lower case characters, numerals, the dollar sign($) and underline(_), and can start with an upper or lower case character, a dollar sign($) or an underline(_), as long as the name of the identifier is not the same as a reserved word.
HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
huiying li
Ranch Hand

Joined: Feb 12, 2001
Posts: 68
Originally posted by ashu s:
Can java keywords consider as alegal identifier?
consider this e.g.
a. number
b. 12color
c. abstract
can somebody tell me where abstract is legal keyword or not?

Here is a useful link:
http://www.cs.umb.edu/java/keywords/

SCJP
ashu s
Greenhorn

Joined: Feb 12, 2001
Posts: 8
Thank you very much Nathan and Huiying.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java keyword as a legal identifier