iT邦幫忙

0

Linkedin Java 檢定題目分享 

  • 分享至 

  • xImage
  •  

前言
在更新Linkedkin 個人檔案的時候
偶然發現他有技術檢定測驗
如果總成績在前30%,會發給你技術認證徽章
如果第一次沒考過可以重考
如果第二次也沒考過就要"等半年!!!" 才能考第二次
本文章為真實考題
個人感覺題目有點像OCA的考題,蠻適合正在學習Java觀念
或工作一段時間但沒深入研究Java的人
如果有需要的人還請自行服用。

Question :
Which code snippet is valid?

  A. Array<String> words = new ArrayList<String>(){"Hello","world"};
  B. ArrayList<String> words = new ArrayList<>(Arrays.asList("Hello", "world"));
  C. ArrayList<String> words = Arrays.asList("Hello","World");
  D. ArrayList<String> words = {"Hello","World"};

anwser: B

解析:
A: 語法錯誤,無法這樣宣告
C: asList方法,返回的型別為List,故編譯階段會出現錯誤。
D: 這樣宣告是一般array的宣告方法,並不是ArrayList的宣告方法

Question :
Which is the most reliable expression for testing whether the values of two string variables are the same?

options:
A. string1.matches(string2)
B. string1.equals(string2)
C. string1 == string2
D. string1 = string2

answer:B

解析:
題目是說何者是Java中最可靠用來比較字串內容的方法
==和equals區別的經典案例
網路上已經有很多教學文章,可自行google


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言