QUESTION 42 Given: 23. Object [] myObjects = { 24. new Integer(12), 25. new String("foo"), 26. new Integer(5), 27. new Boolean(true) 28. }; 29. Arrays.sort(myObjects); 30. for(int i=0; i
ocjp 덤프입니다. ocjp_tesking : 말 그대로 ocjp문제 파일입니다. self tesking 하는 방법 1. OCJP 압축 파일을 푸 신뒤에 manager.exe실행 시켜 줍니다.2. tesking pdf파일을 추가해 준 뒤에 셀프 테스트를 진행 할 수 있습니다. 추가 정보 : https://magiclen.org/ocajp-main-2/ --> 중국어로 되어있지만 비교적 정확한 편입니다 .
QUESTION 41 Given a pre-generics implementation of a method: 11. public static int sum(List list) { 12. int sum = 0; 13. for ( Iterator iter = list.iterator(); iter.hasNext(); ) { 14. int i = ((Integer)iter.next()).intValue(); 15. sum += i; 16. } 17. return sum; 18. } What three changes allow the class to be used with generics and avoid an unchecked warning? (Choose three.) A. Remove line 14. B...
QUESTION 40 Which two statements are true about the hashCode method? (Choose two.) A. The hashCode method for a given class can be used to test for object equality and object inequality for that class. B. The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set. C. The hashCode method for a given class can be used to test for object inequality..
QUESTION 39 Given: 1. public class Person { 2. private String name; 3. public Person(String name) { this.name = name; } 4. public boolean equals(Person p) { 5. return p.name.equals(this.name); 6. } 7. } Which statement is true? A. The equals method does NOT properly override the Object.equals method. B. Compilation fails because the private attribute p.name cannot be accessed in line 5. C. To wo..
QUESTION 38 Given: 1. public class Boxer1{ 2. Integer i; 3. int x; 4. public Boxer1(int y) { 5. x = i+y; 6. System.out.println(x); 7. } 8. public static void main(String[] args) { 9. new Boxer1(new Integer(4)); 10. } 11. } What is the result? A. The value 4 is printed at the command line. B. Compilation fails because of an error in line 5. C. Compilation fails because of an error in line 9. D. A..