반응형
자격증/OCJP_ExamA2018. 7. 8. 22:55QUESTION 59

QUESTION 59 Given: 11. //insert code here 12. private N min, max; 13. public N getMin() { return min; } 14. public N getMax() { return max; } 15. public void add(N added) { 16. if (min == null || added.doubleValue() max.doubleValue()) 19. max = added; 20. } 21. } Which two, inserted at line 11, will allow the code..

자격증/OCJP_ExamA2018. 7. 8. 21:56QUESTION 58

QUESTION 58 Given: import java.util.TreeSet; public class Explorer2 { public static void main(String[] args) { TreeSet s = new TreeSet(); TreeSet subs = new TreeSet(); for(int i = 606; i < 613; i++) if(i%2 == 0) s.add(i); subs = (TreeSet)s.subSet(608, true, 611, true); s.add(629); System.out.println(s + " " + subs); } } What is the result? A. Compilation fails. B. An exception is thrown at runti..

자격증/OCJP_ExamA2018. 7. 8. 21:38QUESTION 57

QUESTION 57 Given: class Foo { public int a = 3; public void addFive() { a += 5; System.out.print("f "); } }class Bar extends Foo { public int a = 8; public void addFive() { this.a += 5; System.out.print("b " ); } } Invoked with: Foo f = new Bar(); f.addFive(); System.out.println(f.a); What is the result? A. b 3 B. b 8 C. b 13 D. f 3 E. f 8 F. f 13 G. Compilation fails. H. An exception is thrown..

자격증/OCJP_ExamA2018. 7. 8. 21:26QUESTION 56

QUESTION 56 Which two classes correctly implement both the java.lang.Runnable and the java.lang. Cloneable interfaces? (Choose two.) A. public class Session implements Runnable, Cloneable { public void run(); public Object clone(); } B. public class Session extends Runnable, Cloneable { public void run() { /* do something */ } public Object clone() { /* make a copy */ } } C. public class Session..

자격증/OCJP_ExamA2018. 7. 8. 21:20QUESTION 55

QUESTION 55 Given: 6. public class Threads2 implements Runnable { 7. 8. public void run() { 9. System.out.println("run."); 10. throw new RuntimeException("Problem"); 11. } 12. public static void main(String[] args) { 13. Thread t = new Thread(new Threads2()); 14. t.start(); 15. System.out.println("End of method."); 16. } 17. } Which two can be results? (Choose two.) A. java.lang.RuntimeException..

자격증/OCJP_ExamA2018. 7. 8. 21:09QUESTION 54

QUESTION 54 Given: 10. public class SuperCalc { 11. protected static int multiply(int a, int b) { return a * b;} 12. } and: 20. public class SubCalc extends SuperCalc{ 21. public static int multiply(int a, int b) { 22. int c = super.multiply(a, b); 23. return c; 24. } 25. } and: 30. SubCalc sc = new SubCalc (); 31. System.out.println(sc.multiply(3,4)); 32. System.out.println(SubCalc.multiply(2,2..

반응형
image