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

자격증/OCJP_ExamC2018. 7. 21. 16:45QUESTION 9

QUESTION 9 Given: 1. package geometry; 2. 3. public class Hypotenuse { 4. public InnerTriangle it = new InnerTriangle(); 5. 6. class InnerTriangle { 7. public int base; 8. public int height; 9. } 10. } Which statement is true about the class of an object that can reference the variable base? A. It can be any class. B. No class has access to base. C. The class must belong to the geometry package...

자격증/OCJP_ExamC2018. 7. 21. 16:42QUESTION 8

QUESTION 8 Given: 01. public class Hello { 02. String title; 03. int value; 04. 05. public Hello() { 06. title += " World"; 07. } 08. 09. public Hello(int value) { 10. this.value = value; 11. title = "Hello"; 12. Hello(); 13. } 14. } and: Hello c = new Hello(5);System.out.println(c.title); What is the result? A. Hello B. Hello World C. Compilation fails. D. Hello World 5 E. The code runs with no..

자격증/OCJP_ExamC2018. 7. 21. 16:37QUESTION 7

QUESTION 7 Which four statements are true? (Choose four.) A. Has-a relationships should never be encapsulated. B. Has-a relationships should be implemented using inheritance. C. Has-a relationships can be implemented using instance variables. D. Is-a relationships can be implemented using the extends keyword. E. Is-a relationships can be implemented using the implements keyword. F. The relations..

반응형
image