JAVA新手必備:Java基礎之關鍵字

發表于:2007-05-25來源:作者:點擊數: 標簽:java必備關鍵字基礎新手
呵呵,不管別的,來幾條題目先,作對了你牛^_^ 1, which of the following are keywords or reserved words in java? a) if b)then c)goto d)while e)case f)sizeof 2, which of the following are java key words? a)double b)Switch c)then d)instanceof 3
  呵呵,不管別的,來幾條題目先,作對了你牛^_^

  1, which of the following are keywords or reserved words in java?
  a) if b)then c)goto d)while e)case f)sizeof

  2, which of the following are java key words?
  a)double b)Switch c)then d)instanceof

  3, which of these are key words in java?
  a) default b)NULL c)String d)throws e)long f)true

  答案來了 1,acde 2,ad 3,adef 作對了嗎^_^

  解釋來了 1,then和sizeof都不是java的關鍵字,熟悉c或者c++,寫慣了asp的高手就要小心嘍。

  2,所有的關鍵字都是小寫的,所以Switch不是關鍵字。instanceof看上去像方法名,但其實是關鍵字;

  3,大寫的NULL不是java語言的關鍵字。String是java語言的一個封裝類的類名,也不是關鍵字。

  再來點系統的:

  正確識別java語言的關鍵字(keyword)和保留字(reserved word)是十分重要的。Java的關鍵字對java的編譯器有特殊的意義,他們用來表示一種數據類型,或者表示程序的結構等。保留字是為java預留的關鍵字,他們雖然現在沒有作為關鍵字,但在以后的升級版本中有可能作為關鍵字。

  關鍵字列表

  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 super switch synchronized this
  throw throws transient true try
  void volatile while
  
  保留字
  const,goto

  注意點

  識別java語言的關鍵字,不要和其他語言如c/c++的關鍵字混淆。

  const和goto是java的保留字。
  所有的關鍵字都是小寫
  friendly,sizeof不是java的關鍵字
  文章轉自Matrix。加入matrix,與java共舞: www.matrix.org.cn

原文轉自:http://www.anti-gravitydesign.com

評論列表(網友評論僅供網友表達個人看法,并不表明本站同意其觀點或證實其描述)
国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97