반응형
자격증/OCJP_ExamC2018. 7. 24. 01:03QUESTION 18

QUESTION 18 Click the Exhibit button. 1. public class Threads1 { 2. int x = 0; 3. public class Runner implements Runnable { 4. public void run(){ 5. int current = 0; 6. for(int i = 0; i

자격증/OCJP_ExamC2018. 7. 21. 18:52QUESTION 17

QUESTION 17 Given: 11. public static void main(String[] args) { 12. Object obj = new int[] { 1, 2, 3 }; 13. int[] someArray = (int[])obj; 14. for (int i : someArray) System.out.print(i + " "); 15. } What is the result?A. 1 2 3 B. Compilation fails because of an error in line 12. C. Compilation fails because of an error in line 13. D. Compilation fails because of an error in line 14. E. A ClassCa..

자격증/OCJP_ExamC2018. 7. 21. 18:27QUESTION 16

QUESTION 16 Given: 1. class TestA { 2. public void start() { System.out.println("TestA"); } 3. } 4. public class TestB extends TestA { 5. public void start() { System.out.println("TestB"); } 6. public static void main(String[] args) { 7. ((TestA)new TestB()).start(); 8. } 9. } What is the result? A. TestA B. TestB C. Compilation fails. D. An exception is thrown at runtime. Solution : B

자격증/OCJP_ExamC2018. 7. 21. 18:24QUESTION 15

QUESTION 15 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_ExamC2018. 7. 21. 17:31QUESTION 14

QUESTION 14 Given: 1. class One { 2. public One foo() { 3. return this; 4. } 5. } 6. 7. class Two extends One { 8. public One foo() { 9. return this; 10. } 11. } 12. 13. class Three extends Two { 14. // insert method here 15. } Which two methods, inserted individually, correctly complete the Three class? (Choose two.) A. public void foo() {} B. public int foo() { return 3; } C. public Two foo() ..

자격증/OCJP_ExamC2018. 7. 21. 17:16QUESTION 13

QUESTION 13 Given: abstract class C1 { public C1() { System.out.print(1); } } class C2 extends C1 { public C2() { System.out.print(2); } } class C3 extends C2 { public C3() { System.out.println(3); } } public class Ctest { public static void main(String[] a) { new C3(); } } What is the result? A. 3 B. 23 C. 32 D. 123 E. 321 F. Compilation fails. G. An exception is thrown at runtime. Solution : D

반응형
image