Is main a valid Java identifier?

后端 未结 12 1981
广开言路
广开言路 2020-12-23 02:48

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. 123

12条回答
  •  自闭症患者
    2020-12-23 03:03

    That teacher made a minor mistake in either assuming main is not a valid identifier or simply phrasing the question wrong. He possibly meant to say "a good identifier".
    But ignoring your sons arguments and thereby discouraging his scientific approach of checking relevant literature (Java specification) and performing an experiment (writing a sample program) is the exact opposite of what a teacher is supposed to do.

提交回复
热议问题