Java - class 名称以数字开头
Java - class name starts with numbers
我已经完成了我的 HW,但我们的导师希望我们以 yourID_BFS_DFS.java 的形式提交 HW。我不能那样做,它 returns 错误。 我知道数字不是Java字母并且它是非法的(我已经检查了其他答案)但我还是想问你伙计们,如果有办法(也许是技巧)做到这一点,或者他只是想让我们完成一些非法的事情?如果我没记错的话,java 语言最近几天更新了,也许是关于那个,我真的不知道。
B.t.w。我联系不上他问,他从不回答。所以我又来这里问了。
第一个字符必须是 "Java letter",包括字母、下划线和美元符号。
见https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8
An identifier is an unlimited-length sequence of Java letters and Java
digits, the first of which must be a Java letter.
[...]
The "Java letters" include uppercase and lowercase ASCII Latin letters
A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical
reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or
\u0024). The $ character should be used only in mechanically generated
source code or, rarely, to access pre-existing names on legacy
systems.
[...]
Letters and digits may be drawn from the entire Unicode character set,
which supports most writing scripts in use in the world today,
including the large sets for Chinese, Japanese, and Korean. This
allows programmers to use identifiers in their programs that are
written in their native languages.
无法以 java class 开头。
我猜他的意思是你应该用这种格式 "IDxxxxxx_BFS_DFS"
但最好的理解方式是向他请教。
我已经完成了我的 HW,但我们的导师希望我们以 yourID_BFS_DFS.java 的形式提交 HW。我不能那样做,它 returns 错误。 我知道数字不是Java字母并且它是非法的(我已经检查了其他答案)但我还是想问你伙计们,如果有办法(也许是技巧)做到这一点,或者他只是想让我们完成一些非法的事情?如果我没记错的话,java 语言最近几天更新了,也许是关于那个,我真的不知道。
B.t.w。我联系不上他问,他从不回答。所以我又来这里问了。
第一个字符必须是 "Java letter",包括字母、下划线和美元符号。
见https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8
An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter. [...]
The "Java letters" include uppercase and lowercase ASCII Latin letters A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $ character should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems. [...]
Letters and digits may be drawn from the entire Unicode character set, which supports most writing scripts in use in the world today, including the large sets for Chinese, Japanese, and Korean. This allows programmers to use identifiers in their programs that are written in their native languages.
无法以 java class 开头。 我猜他的意思是你应该用这种格式 "IDxxxxxx_BFS_DFS"
但最好的理解方式是向他请教。