Java語言中,爲各類變量、方法和類等起的名字稱爲標識符
Java標識符的命名規則:
應以字母、下劃線、美圓符開頭
後跟字母、下劃線、美圓符或數字
Java標識符大小寫敏感,長度無限制
1.java中能用做標識符的有:26個英文字母(大、小寫),數字,下劃線,美圓符號$。
可是不能以數字開頭。
2.類名首個字母必須大寫,多個單詞組成的,每一個單詞首字母都要大寫。
3.方法名通常首個字母小寫(構造方法例外),多個單詞組成方法名,後面單詞首字母大寫。
4.變量命名規則同方法名名。
注意:不能使用java中的關鍵字作標識符。
Java保留關鍵字java
Java語言有51個關鍵字,其中const和goto雖然被保留但未使用。你不能使用保留關鍵字來命名類、方法或變量。this
保留關鍵字spa
數據類型:it
Boolean int long short byte float double char class interfaceclass
流程控制:import
if else do while for switch case default break continue return try catch finally變量
修飾符: 數據類型
public protected private final void static strictfp abstract transientfloat
synchronized volatile native方法
動做:
package import throw throws extends implements this Super instanceof new
保留字:
true false null goto const