반응형
자격증/OCJP_ExamD2018. 7. 29. 15:51QUESTION 5

QUESTION 5 Click the Exhibit button. 1. public class GoTest { 2. public static void main(String[] args) { 3. Sente a = new Sente(); a.go(); 4. Goban b = new Goban(); b.go(); 5. Stone c = new Stone(); c.go(); 6. } 7. } 8. 9. class Sente implements Go { 10. public void go(){ 11. System.out.println("go in Sente"); 12. } 13. } 14. 15. class Goban extends Sente { 16. public void go(){ 17. System.out...

자격증/OCJP_ExamD2018. 7. 26. 20:03QUESTION 4

QUESTION 4 Given: 1. public class Plant { 2. private String name; 3. 4. public Plant(String name) { 5. this.name = name; 6. } 7. 8. public String getName() { 9. return name; 10. } 11. } 1. public class Tree extends Plant { 2. public void growFruit() { 3. } 4. 5. public void dropLeaves() { 6. } 7. } Which statement is true? A. The code will compile without changes. B. The code will compile if pub..

자격증/OCJP_ExamD2018. 7. 26. 19:59QUESTION 3

QUESTION 3 Click the Exhibit button. 01. public class A { 02. public String doit(int x, int y){ 03. return "a"; 04. } 05. 06. public String doit(int... vals){ 07. return "b"; 08. } 09. } Given: 25. A a = new A(); 26. System.out.println(a.doit(4, 5)); What is the result? A. Line 26 prints a to System.out. B. Line 26 prints b to System.out. C. An exception is thrown at line 26 at runtime. D. Compi..

자격증/OCJP_ExamD2018. 7. 26. 19:56QUESTION 2

QUESTION 2 Given: 11. class Converter { 12. public static void main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. System.out.println("It is " + (j == i) + " that j==i."); 16. } 17. } What is the result when the programmer attempts to compile the code and run it with the command java Converter 12? A. It is true that j==i. B. It is false that j==i. C. An exception is thrown at runt..

자격증/OCJP_ExamD2018. 7. 26. 19:42QUESTION 1

QUESTION 1 Given: 1. public class KungFu { 2. public static void main(String[] args) { 3. Integer x = 400; 4. Integer y = x; 5. x++; 6. StringBuilder sb1 = new StringBuilder("123"); 7. StringBuilder sb2 = sb1; 8. sb1.append("5"); 9. System.out.println((x == y) + " " + (sb1 == sb2)); 10. } 11. } What is the result? A. true true B. false true C. true false D. false false E. Compilation fails. F. A..

반응형
image