Java文法(5)—Identifier

----------------------------------------------------------------------------------------------------------------
说明:
    An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.
------------------------------------------------------------------------------------------------------------------
文法:
    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.
        A "Java letter-or-digit" is a character for which the method Character.isJavaIdentifierPart(int) returns true.
        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.
        The "Java digits" include the ASCII digits 0-9 (\u0030-\u0039).
        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.
        An identifier cannot have the same spelling (Unicode character sequence) as a keyword (§3.9), boolean literal (§3.10.3),
        or the null literal (§3.10.7), or a compile- time error occurs.
        Two identifiers are the same only if they are identical, that is, have the same Unicode character for each letter or digit.
        Identifiers that have the same external appearance may yet be different.
        For example, the identifiers consisting of the single letters LATIN CAPITAL LETTER A (A, \u0041), LATIN SMALL LETTER A (a, \u0061),
         GREEK CAPITAL LETTER ALPHA (A, \u0391), CYRILLIC SMALL LETTER A (a, \u0430) and MATHEMATICAL BOLD ITALIC SMALL A (a,\ud835\udc82) are all different.
        Unicode composite characters are different from their canonical equivalent decomposed characters. For example,
        a LATIN CAPITAL LETTER A ACUTE (Á,\u00c1) is different from a LATIN CAPITAL LETTER A (A, \u0041) immediately followed by
        a NON- SPACING ACUTE ( ?,\u0301) in identifiers. See The Unicode Standard, Section 3.11 "Normalization Forms".
        Examples of identifiers are:
            • String
            • i3
            • αρετη
            • MAX_VALUE
            • isLetterOrDigit
时间: 2024-08-02 07:01:52

Java文法(5)—Identifier的相关文章

Java文法(7)—Literals

----------------------------------------------------------------------------------------------------------------------------------- 说明: A literal is the source code representation of a value of a primitive type (§4.2), the String type (§4.3.3), or th

Java文法(6)—keywords

-------------------------------------------------------------------------------------------------------------------------- 说明: 50 character sequences, formed from ASCII letters, are reserved for use as keywords and cannot be used as identifiers (§3.8

Java文法(2)—— 语句分析文法

------------------------------------------------------------------------------------------------------------------- 扩展一(换行符定义): LineTerminator: the ASCII LF character, also known as "newline" the ASCII CR character, also known as "return&qu

Java文法(8)—Separators 和 Operators

-------------------------------------------------------------------------------------------------------------------- 扩展一(Separators): ----------------------------------------------------------------------------------------------------------------- 说明

Java文法(4)—comments

------------------------------------------------------------------------------------------------------ 说明: There are two kinds of comments. • /* text */ A traditional comment: all the text from the ASCII characters /* to the ASCII characters */ is ig

Java文法(1)—— 文法标记

============================================================================================ 说明: 语法标记用来表达一种语法结构 Terminal symbols are shown in fixed width font in the productions of the lexical and syntactic grammars, and throughout this specification

Java文法(3)—— White Space

------------------------------------------------------------------------------- 说明: White space is defined as the ASCII space character, horizontal tab character, form feed character, and line terminator characters (§3.4). ---------------------------

实习培训——Java基础(2)

1  Java 变量类型 在Java语言中,所有的变量在使用前必须声明.声明变量的基本格式如下: type identifier [ = value][, identifier [= value] ...] ; 格式说明:type为Java数据类型.identifier是变量名.可以使用逗号隔开来声明多个同类型变量. 以下列出了一些变量的声明实例.注意有些包含了初始化过程. int a, b, c; // 声明三个int型整数:a. b.c int d = 3, e = 4, f = 5; //

关于 Java 你不知道的 10 件事

作为 Java 书呆子,比起实用技能,我们会对介绍 Java 和 JVM 的概念细节更感兴趣.因此我想推荐 Lukas Eder 在 jooq.org 发表的原创作品给大家. 你是从很早开始就一直使用 Java 吗?那你还记得它的过去吗?那时,Java 还叫 Oak,OO 还是一个热门话题,C++ 的 folk 者认为 Java 是不可能火起来,Java 开发的小应用程序 Applets 还受到关注. 我敢打赌,下面我要介绍的这些事,有一半你都不知道.下面让我们来深入探索 Java 的神秘之处.