Java有多少個關鍵字


 
為了方便我直接復制過來了,原文如下: 
 
Here's a list of keywords in the Java programming language. 
下面是Java編程語言的關鍵字列表。
 
You cannot use any of the following as identifiers in your programs. 
你不能使用下列任何一個單詞做程序標識符。
 
The keywords const and goto are reserved, even though they are not currently used.
 關鍵字const和goto語句是保留的,雖然他們目前沒有使用。
 
 true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.
 true,false,和null看起來是關鍵字,但它們實際上是字面值;你不能用它們作為程序標識符。
 

abstract

continue

for

new

switch

assert***

default

goto*

package

synchronized

boolean

do

if

private

this

break

double

implements

protected

throw

byte

else

import

public

throws

case

enum****

instanceof

return

transient

catch

extends

int

short

try

char

final

interface

static

void

class

finally

long

strictfp**

volatile

const*

float

native

super

while

 

*

 

not used

**

 

added in 1.2

***

 

added in 1.4

****

 

added in 5.0 

 
 
訪問控制
  1. private 私有的
  2. protected 受保護的
  3. public 公共的
類、方法、變量の修飾符
  1. abstract 聲明抽象
  2. class 類
  3. extends 擴允,繼承
  4. final 終極,不可改變的
  5. implements實現
  6. interface 接口
  7. native 本地
  8. new 新,創建
  9. static 靜態
  10. strictfp 嚴格,精准
  11. synchronized 線程,同步
  12. transient 短暫
  13. volatile 易失
  14. const
  15. assert
程序控制語句
  1. break 跳出循環
  2. continue 繼續
  3. return 返回
  4. do 運行
  5. while 循環
  6. if 如果
  7. else 反之
  8. for 循環
  9. instanceof 實例
  10. switch 開關
  11. case 返回開關里的結果
  12. default 默認
  13. goto 
錯誤處理
  1. catch 處理異常
  2. finally 有沒有異常都執行
  3. throw 拋出一個異常對象
  4. throws 聲明一個異常可能被拋出
  5. try 捕獲異常
包相關
  1. import 引入
  2. package 包
基本類型 
  1. boolean 布爾型
  2. byte 字節型
  3. char 字符型
  4. double 雙精度,
  5. float 浮點
  6. int 整型
  7. long 長整型
  8. short 短整型
變量引用
  1. super 父類,超類
  2. this 本類
  3. void 無返回值
  4. enum 枚舉類型
共有:3+15+13+5+2+8+4=50個關鍵字,全部是小寫
 
結論:
  1. const、goto 是關鍵字,雖然沒用,但不能拿來當變量名
  2. true、false、null 不是關鍵字,但也不能用來當變量名
  3. friendly、sizeof 不是關鍵字,可以用來當變量名 
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM