新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Java駝峰命名法詳解(必看篇)-創(chuàng)新互聯(lián)
標識符:
Java對各種變量、方法和類等要素命名時使用的字符序列稱為標識符
凡是自己可以起名字的地方都叫標識符
定義合法標識符的規(guī)則:
由26個英文字母大小寫,0-9,_或$組成
數(shù)字不可以開頭
不可以使用關(guān)鍵字和保留字,但是能包括關(guān)鍵字和保留字
Java中嚴格區(qū)分大小寫,長度無限制
標識符不能包括空格
取名盡量做到“見名知意”
關(guān)于使用中文,Oracle 官網(wǎng)給出的文檔是這樣描述的:
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 {JavaLetterOrDigit} JavaLetter: any Unicode character that is a "Java letter" JavaLetterOrDigit: any Unicode character that is a "Java letter-or-digit" 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 $ sign 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.
當前題目:Java駝峰命名法詳解(必看篇)-創(chuàng)新互聯(lián)
瀏覽地址:http://fisionsoft.com.cn/article/ddppii.html