Java中的包、類、方法、參數(shù)和變量的名字由任意順序的大小字母、數(shù)字、下劃線(_)、和美元符號(hào)($)組成,
標(biāo)識(shí)符:不能以數(shù)字開頭、也不能是JAVA中的保留關(guān)鍵字
如:yourname、yourname_dxh、li_yourname、$yourname都是合法的標(biāo)識(shí)符
class、67.9,Hello World是不合法的,class是關(guān)鍵字,67.9以數(shù)字開頭,Hello World中間有空格
二、關(guān)鍵字Java中的關(guān)鍵字
| abstract | boolean | break | byte | case | catch | char |
| class | continue | default | do | double | else | extends |
| false | final | finally | float | for | if | implements |
| import | instanceof | int | interface | long | native | new |
| null | package | PRivate | protected | public | return | short |
| static | synchronized | super | this | throw | throws | transient |
| true | try | void | volatile | while | assert | enum |
//表示單行注釋,注釋內(nèi)容在這里,注釋一行,在需要注釋的內(nèi)容前加雙斜線(//)
/**多行注釋,以單斜線加一個(gè)星(/*)開頭,以星加一個(gè)單斜線(*/)結(jié)尾*/
/***文檔注釋*以單斜線加兩個(gè)星形標(biāo)記開頭(/**),以一個(gè)星形標(biāo)記加一個(gè)斜線(*/)結(jié)尾*這種方法注釋的內(nèi)容會(huì)被解釋成程序的正式文檔,并能包含在如:javadoc*之類工具生成的文檔中*/
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注