Sun認證Java程序員SCJP考題常見陷阱

時間:2024-06-14 11:27:59 SUN認證 我要投稿
  • 相關推薦

Sun認證Java程序員(SCJP)考題常見陷阱集合

  (1) Two public classes in the same file. (illegal)

Sun認證Java程序員(SCJP)考題常見陷阱集合

  同一個文件里有兩個public類。(非法)

  (2) Main method calling a non-static method. (illegal)

  在main(String[] args)方法內調用一個非靜態方法。(非法)

  (3) Methods with the same name as the constructor(s). (這種題常有)

  與Constructor(s)有相同名字的方法。

  (4) Thread initiation with classes that do not have a run() method.

  初始化了一個沒有run()方法的線程類。

  (5) Local inner classes trying to access non-final vars. (illegal)

  內部類嘗試訪問非final變量(非法)

  (6) Case statements with values out of permissible range. (byte,int, short,chat)

  選擇語句case中,沒有使用允許的值。如(byte、int、short、char)等

  (7) Math class being an option for immutable classes !! (totally wrong!)

  Math類作為不可改變類。(完全錯誤)

  (8) instanceOf is not same as instanceof.

  instanceOf不是instanceof。

  (9) Private constructors. (legal)

  私有的Constructor。(合法)

  (10)An assignment statement which looks like a comparison.

  一個賦值語句看起來像比較語句。

  比如說if(a=true),和if(a==true)。對于這種題眼睛亮一點。

  (11)System.exit() in try-catch-finally blocks. (finally不會執行)

  在try-catch-final塊中的退出語句。(finally不會執行)

  (12)Order of try-catch-finally blocks matters. (若順序錯的話: error: No try before catch)

  try-catch-final塊的順序問題。

  (13)main() can be declared final. (OK)

  main()方法可以聲明為final。

  (14) -0.0 == 0.0 is true.

  (15)A class without abstract methods can still be declared abstract.

  沒有抽象方法的類,仍然可以定義為抽象類。

【Sun認證Java程序員SCJP考題常見陷阱】相關文章:

Sun認證Java程序員(SCJP)考試科目介紹03-19

合格Sun認證Java程序員(SCJP)具備的能力03-19

Sun認證Java程序員(SCJP)考試科目的區別03-19

sun認證java程序員須知Java日志框架03-30

SUN JAVA認證介紹12-18

sun java認證考試介紹03-19

Sun Java認證考試科目03-19

sun java認證報考指南03-08

怎樣獲得Sun Java認證03-18

亚洲制服丝袜二区欧美精品,亚洲精品无码视频乱码,日韩av无码一区二区,国产人妖视频一区二区
亚洲精品中字在线 | 在线人成亚洲视频免费观看 | 开心六月综合激情婷婷 | 亚洲国产中文精品高清在线电影 | 在线日本v二区不卡中文字幕 | 一区区日韩国产欧美- |