gpt4 book ai didi

java标识符

转载 作者:行者123 更新时间:2023-11-30 06:37:41 25 4
gpt4 key购买 nike

到处都说 Java 标识符可以以所有字符(但不是数字)开头,包括 $_

但我注意到像 isJavaIdentifierStart 这样的方法对于其他字符也返回 true像 §, £,

然而,以这些字符开头的标识符是否正确?

最佳答案

如果 isJavaIdentifierStart 为它返回 true,那么根据定义,它是一个有效的 Java 标识符起始字符,因为它是 how the specification defines it :

Identifier:
      IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
IdentifierChars:
      JavaLetter
      IdentifierChars JavaLetterOrDigit
JavaLetter:
      any Unicode character that is a Java letter (see below)
JavaLetterOrDigit:
      any Unicode character that is a Java letter-or-digit (see below)
...
A "Java letter" is a character for which the method Character.isJavaIdentifierStart(int) returns true.

关于java标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3147146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com