• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mughal's mock exam erratum

 
Panagiotis Varlagas
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mughal's mcok exam has the following erratum:
QUESTION:
Which are valid identifiers:
(a) class
(b) $value$
(c)zer@
(d)angstroem
(e)2much
It specifies the correct answer as being (a), (b) and (d).
However class is not an identifier as per $3.8 of the JLS:
"An identifier cannot have the same spelling (Unicode character sequence) as a keyword, boolean literal, or the null literal."
class being a keyword and given the above quote from JLS it follows that class in not an identifier. Hence the answer claimed to be correct actually is not, the correct answer being (b) and (d).
Panagiotis.

 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you. class is a keyword so you can't use it for variable or method names.
 
vishad patel
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also agree with you.
bye.
vishad patel
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ditto. 'class' is definitely a keyword.
------------------
Jane
The cure for boredom is curiosity.
There is no cure for curiosity.
-- Dorothy Parker
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic