반응형
자격증/OCJP_ExamD2018. 7. 29. 16:18QUESTION 8

QUESTION 8 Given: 1. public class TestOne { 2. public static void main (String[] args) throws Exception { 3. Thread.sleep(3000); 4. System.out.println("sleep"); 5. } 6. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The code executes normally and prints sleep. D. The code executes normally, but nothing is printed. Solution : C

자격증/OCJP_ExamD2018. 7. 29. 16:14QUESTION 7

QUESTION 7 Click the Exhibit button. 10. interface Foo{ 11. int bar(); 12. } 13. 14. public class Beta { 15. 16. class A implements Foo { 17. public int bar(){ return 1; } 18. } 19. 20. public int fubar(Foo foo){ return foo.bar(); } 21. 22. public void testFoo(){ 23. 24. class A implements Foo{ 25. public int bar(){return 2;} 26. } 27. 28. System.out.println(fubar(new A())); 29. } 30. 31. public..

자격증/OCJP_ExamD2018. 7. 29. 15:56QUESTION 6

QUESTION 6 Given: 11. public interface A111 { 12. String s = "yo"; 13. public void method1(); 14. } 15. 16. 17. interface B {} 18. 19. 20. interface C extends A111, B { 21. public void method1(); 22. public void method1(int x); 23. } What is the result? A. Compilation succeeds. B. Compilation fails due to multiple errors. C. Compilation fails due to an error only on line 20. D. Compilation fails..

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

반응형
image