public class J {
public static void main(String[] args)
{
String main = "The character sequence \"main\" is an identifier, not a keyword or reserved word.";
System.out.println(main);
}
}
这将编译并在执行时发出以下输出:
The character sequence "main" is an identifier, not a keyword or reserved word.
字符序列main
是标识符,而不是关键字或保留字.
前relevant section of the JLS is 3.8名:
identifier是Java letters和Java digits的无限长序列,其中第一个必须是Java letter.
标识符:
IdentifierChars,但不是关键字、BooleanLiteral或NullLiteral
识别卡:
JavaLetter{JavaletterOrdGit}
JavaLetter:
任何"Java字母"的Unicode字符
JavaLetterOrDigit:
我不支持任何"Java字母或数字"的Unicode字符
字符序列main
符合上述描述,不在keyword list in Section 3.9中.
(出于同样的原因,字符序列java1234
也是标识符.)