QUESTION 23자격증/OCJP_ExamC2018. 7. 24. 02:46
Table of Contents
반응형
QUESTION 23Given:public class Person {private String name;public Person(String name) {this.name = name;}public boolean equals(Object o) {if ( ! ( o instanceof Person) ) return false;Person p = (Person) o;return p.name.equals(this.name);}}Which statement is true?A. Compilation fails because the hashCode method is not overridden.B. A HashSet could contain multiple Person objects with the same name.C. All Person objects will have the same hash code because the hashCode method is not overridden.D. If a HashSet contains more than one Person object with name="Fred", then removing another Person, also with name="Fred", will remove them all.Solution : B
반응형
'자격증 > OCJP_ExamC' 카테고리의 다른 글
QUESTION 25 (0) | 2018.07.24 |
---|---|
QUESTION 24 (0) | 2018.07.24 |
QUESTION 22 (0) | 2018.07.24 |
QUESTION 21 (0) | 2018.07.24 |
QUESTION 20 (0) | 2018.07.24 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상