QUESTION 26자격증/OCJP_ExamC2018. 7. 24. 03:16
Table of Contents
반응형
QUESTION 26Given:public class Drink implements Comparable {public String name;public int compareTo(Object o) {return 0;}}and:Drink one = new Drink();Drink two = new Drink();one.name= "Coffee";two.name= "Tea";TreeSet set = new TreeSet();set.add(one);set.add(two);A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?A. TeaB. CoffeeC. Coffee TeaD. Compilation fails.E. The code runs with no output.F. An exception is thrown at runtime.Solution : B
반응형
'자격증 > OCJP_ExamC' 카테고리의 다른 글
QUESTION 28 (0) | 2018.07.24 |
---|---|
QUESTION 27 (0) | 2018.07.24 |
QUESTION 25 (0) | 2018.07.24 |
QUESTION 24 (0) | 2018.07.24 |
QUESTION 23 (0) | 2018.07.24 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상