• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

String - is it a valid identifier? (simple question)

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question concerns another question from SCJP:
9. Chose the valid identifiers?
A) int100
B) byte
C) aString
D) a-Big-Integer
E) Boolean
F) strictfp

Answer 9:
A) int 100
C) aString
E) Boolean

Well, if Boolean is OK, I wonder if String is also correct. What do you think?
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

According to JLS - 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. An identifier cannot have the same spelling (Unicode character sequence) as a keyword (�3.9), boolean literal (�3.10.3), or the null literal (�3.10.7).


So yes, "String" can be used as an identifier. But as to whether this is a good idea...
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Piotr Milewski:
...What do you think?


I think that writing test code is a great way to prepare for the SCJP exam.
 
Piotr Milewski
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the answers!


I think that writing test code is a great way to prepare for the SCJP exam.



Yes, you're right. This was my first post, so forgive me writing it before trying to compile the code. I'll do my best to keep it in mind. Thanks .
[ June 26, 2007: Message edited by: Piotr Milewski ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic