반응형
자격증/OCJP_ExamB2018. 7. 13. 23:24QUESTION 60

QUESTION 60 Given: 3. import java.util.*; 4. public class Hancock { 5. // insert code here 6. list.add("foo"); 7. } 8. } Which two code fragments, inserted independently at line 5, will compile without warnings? (Choose two.) A. public void addStrings(List list) { B. public void addStrings(List list) { C. public void addStrings(List list) { D. public void addStrings(List list) { Solution : BC

자격증/OCJP_ExamB2018. 7. 13. 23:20QUESTION 59

QUESTION 59 Given: int x = 0;int y = 10; do { y--; ++x;} while (x

자격증/OCJP_ExamB2018. 7. 13. 22:03QUESTION 58

QUESTION 58 Given: 11. public class Test { 12. public static void main(String [] args) { 13. int x = 5; 14. boolean b1 = true; 15. boolean b2 = false; 16. 17. if ((x == 4) && !b2 ) 18. System.out.print("1 "); 19. System.out.print("2 "); 20. if ((b2 = true) && b1 ) 21. System.out.print("3 "); 22. } 23. } What is the result? A. 2 B. 3 C. 1 2 D. 2 3 E. 1 2 3 F. Compilation fails. G. An exception is..

자격증/OCJP_ExamB2018. 7. 13. 21:45QUESTION 57

QUESTION 57Given: static void test() throws RuntimeException { try { System.out.print("test "); throw new RuntimeException(); } catch (Exception ex) { System.out.print("exception "); }} public static void main(String[] args) { try { test(); } catch (RuntimeException ex) { System.out.print("runtime "); } System.out.print("end ");} What is the result? A. test end B. Compilation fails. C. test runt..

자격증/OCJP_ExamB2018. 7. 13. 21:39QUESTION 56

QUESTION 56 Given: 1. public class Mud { 2. //insert code here 3. System.out.println("hi"); 4. } 5. } And the following five fragments: public static void main(String...a){ public static void main(String.* a) { public static void main(String... a) { public static void main(String[]... a) { public static void main(String...[] a) { How many of the code fragments, inserted independently at line 2, ..

자격증/OCJP_ExamB2018. 7. 13. 21:32QUESTION 55

QUESTION 55 Given: 1. public class Threads4 { 2. public static void main (String[] args) { 3. new Threads4().go(); 4. } 5. public void go() { 6. Runnable r = new Runnable() { 7. public void run() { 8. System.out.print("foo"); 9. } 10. }; 11. Thread t = new Thread(r); 12. t.start(); 13. t.start(); 14. } 15. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The c..

반응형
image