Java有多少個關鍵字

來源:互聯網
上載者:User

標籤:

官方說法:http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html 為了方便我直接複製過來了,原文如下:  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 不是關鍵字,可以用來當變數名 
  

Java有多少個關鍵字

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.