码迷,mamicode.com
首页 > 编程语言 > 详细

Java文法(5)—Identifier

时间:2015-01-22 23:17:54      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

----------------------------------------------------------------------------------------------------------------
说明:
    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

 

Java文法(5)—Identifier

标签:

原文地址:http://www.cnblogs.com/xyhr/p/4242900.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!