阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 151-200#99330 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 151-200#99330

年份:104年

科目:OJCP(SCJP)

193. Given that the elements of a PriorityQueue are ordered according to natural ordering, and: 
2. import java.util.*; 
3. public class GetInLine{ 
4. public static void main(String[] args){
 5. PriorityQueue<String> pq = new PriorityQueue<String>(); 
6. pq.add("banana"); 
7. pq.add("pear"); 
8. pq.add("apple"); 
9. System.out.println(pq.poll() + " " + pq.peek()); 
10. } 
11. } 
What is the result?
(A) apple pear
(B) banana pear
(C) apple apple
(D) apple banana
(E) banana banana
正確答案:登入後查看