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

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

QUESTION 12 Given: 1. class Alligator { 2. public static void main(String[] args) { 3. int[] x[] = { { 1, 2 }, { 3, 4, 5 }, { 6, 7, 8, 9 } }; 4. int[][] y = x; 5. System.out.println(y[2][1]); 6. } 7. } What is the result? A. 2 B. 3 C. 4 D. 6 E. 7 F. Compilation fails. Solution : E

자격증/OCJP_ExamC2018. 7. 21. 17:06QUESTION 11

QUESTION 11 Given: 10. interface Data { public void load(); } 11. abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class? A. public class Employee extends Info implements Data { public void load() { /*do something*/ } } B. public class Employee implements Info extends Data { public void load() { /*do something*/ } } C. public class Emplo..

자격증/OCJP_ExamC2018. 7. 21. 16:55QUESTION 10

QUESTION 10 Click the Exhibit button. 1. public class A { 2. 3. private int counter = 0; 4. 5. public static int getInstanceCount(){ 6. return counter; 7. } 8. 9. public A(){ 10. counter++; 11. } 12. } 13. Given this code from Class B: A a1 = new A(); A a2 = new A(); A a3 = new A(); System.out.println(A.getInstanceCount()); What is the result? A. Compilation of class A fails. B. Line 28 prints t..

반응형
image