반응형
자격증/OCJP_ExamB2018. 7. 10. 15:29QUESTION 22

QUESTION 22 Given: 1. class X { 2. X() { System.out.print(1); } 3. X(int x) { 4. this(); System.out.print(2); 5. } 6. } 7. public class Y extends X { 8. Y() { super(6);System.out.print(3); } 9. Y(int y) { 10. this(); System.out.println(4); 11. } 12. public static void main(String[] a) { new Y(5); } 13. } What is the result? A. 13 B. 134 C. 1234 D. 2134 E. 2143 F. 4321 Solution : C

자격증/OCJP_ExamB2018. 7. 10. 15:21QUESTION 21

QUESTION 21 Given: abstract public class Employee{ protected abstract double getSalesAmount(); public double getCommision() { return getSalesAmount() * 0.15; } } class Sales extends Employee {17. // insert method here } Which two methods, inserted independently at line 17, correctly complete the Sales class? (Choose two.) A. double getSalesAmount() { return 1230.45; } B. public double getSalesAm..

자격증/OCJP_ExamB2018. 7. 9. 21:14QUESTION 20

QUESTION 20 Given:class One { void foo() { } }class Two extends One{ 14. // insert method here } Which three methods, inserted individually at line 14, will correctly complete class Two? (Choose three.) A. int foo() { /* more code here */ } B. void foo() { /* more code here */ } C. public void foo() { /* more code here */ } D. private void foo() { /* more code here */ } E. protected void foo() {..

자격증/OCJP_ExamB2018. 7. 9. 21:04QUESTION 19

QUESTION 19 Given: 1. public class Threads5 { 2. public static void main (String[] args) { 3. new Thread(new Runnable() { 4. public void run() { 5. System.out.print("bar"); 6. }}).start(); 7. } 8. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The code executes normally and prints bar. D. The code executes normally, but nothing prints. Solution : C

자격증/OCJP_ExamB2018. 7. 9. 21:01QUESTION 18

QUESTION 18 Given: Runnable r = new Runnable() { public void run() { System.out.print("Cat"); } }; Thread t = new Thread(r) { public void run() { System.out.print("Dog"); } }; t.start(); What is the result? A. Cat B. Dog C. Compilation fails. D. The code runs with no output. E. An exception is thrown at runtime. Solution : B

자격증/OCJP_ExamB2018. 7. 9. 20:55QUESTION 17

QUESTION 17 Given that t1 is a reference to a live thread, which is true? A. The Thread.sleep() method can take t1 as an argument. B. The Object.notify() method can take t1 as an argument. C. The Thread.yield() method can take t1 as an argument. D. The Thread.setPriority() method can take t1 as an argument. E. The Object.notify() method arbitrarily chooses which thread to notify. Solution : Eplu..

반응형
image