반응형
자격증/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..

자격증/OCJP_ExamA2018. 7. 8. 20:06QUESTION 53

QUESTION 53 A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company's old printers, but the new wireless printers ..

자격증/OCJP_ExamA2018. 7. 8. 19:43QUESTION 52

QUESTION 52 Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The variable first is set to null. D. The variable first is set to elements[0]. Solution : D String 배열인 elements 는 총 3개의 방에 각각 값이 들어가 있으며 , length또한 0보다 크다 , 고로 elements[0] 만약 elements.length ..

자격증/OCJP_ExamA2018. 7. 8. 19:36QUESTION 51

QUESTION 51 Given two files: GrizzlyBear.java and Salmon.java 1. package animals.mammals; 2. 3. public class GrizzlyBear extends Bear { 4. void hunt() { 5. Salmon s = findSalmon(); 6. s.consume(); 7. } 8. } 1. package animals.fish; 2. 3. public class Salmon extends Fish { 4. public void consume() { /* do stuff */ } 5. } If both classes are in the correct directories for their packages, and the M..

자격증/OCJP_ExamA2018. 7. 8. 19:18QUESTION 50

QUESTION 50 Given: 1. interface Animal { void makeNoise(); } 2. class Horse implements Animal { 3. Long weight = 1200L; 4. public void makeNoise() { System.out.println("whinny"); } 5. } 6. 7. public class Icelandic extends Horse { 8. public void makeNoise() { System.out.println("vinny"); } 9. public static void main(String[] args) { 10. Icelandic i1 = new Icelandic(); 11. Icelandic i2 = new Icel..

반응형
image