One of my kids is taking Java in high school and had this on one of his tests:
Which of the following is a valid identifier in Java?
a.
123java
b.main
c.java1234
d.{abce
e.)whoot
He answered b and got it wrong.
I looked at the question and argued that main
is a valid identifier and that it should have been right.
We took a look at the Java spec for identifiers and it reinforced that point. We also wrote a sample program that had a variable called main
, as well as a method. He created a written rebuttal that included the Java documentation reference, the test program and the teacher ignored it and says the answer is still incorrect.
Is main
a valid identifier?