常见的标识符
關(guān)鍵字
| case | catch | char | class | const |
| continue | default | do | double | else |
| enum | extends | final | finally | float |
| for | goto | if | implements | import |
| instanceof | int | interface | long | native |
| new | package | private | protected | public |
| return | strictfp | short | static | super |
| switch | synchronized | this | throw | throws |
| transient | try | void | volatile | while |
注:Java所有的組成部分都需要名字。類名、變量名以及方法名都被成為標(biāo)識符。
標(biāo)識符注意點
所有標(biāo)識符都應(yīng)以字母(A~Z或者a~z),美元符($)、或者下劃線(_)開始。
首字符之后可以是字母(A~Z或者a~z),美元符($)、或者下劃線(_)或數(shù)字的任何字符組合。
不能使用關(guān)鍵字作為變量名或方法名。
標(biāo)識符是大小寫敏感的。
合法標(biāo)識符舉例:age、$salary、value、1_value
非法標(biāo)識符舉例:123abc、-salary、#abc
可以使用中文命名,但是一般不建議,也不建議試用拼音,Low。
- public class Demo1 {public static void main (String[] args){String 和平精英 ="超級王牌";//String 王者榮耀 ="百星王者";System.out.println(和平精英);} }
總結(jié)
- 上一篇: Delphi7_Lite_Fullv7.
- 下一篇: 职场的5个时间管理技巧