Java OCA OCP Practice Question 112

Question

Given:

1. public class Task implements Actionable 
     { public void doIt() { } } 
2. /* w w w  .j ava 2 s .  com*/
3. abstract class Test extends Task { } 
4. 
5. abstract class Compile extends Task 
     { public void doIt(int x) { } } 
6. 
7. class Run extends Task implements Actionable 
     { public void doStuff() { } } 
8. 
9. interface Actionable { public void doIt(); } 

What is the result? (Choose all that apply.)

  • A. Compilation succeeds
  • B. Compilation fails with an error on line 1
  • C. Compilation fails with an error on line 3
  • D. Compilation fails with an error on line 5
  • E. Compilation fails with an error on line 7
  • F. Compilation fails with an error on line 9


A is correct; all of these are legal declarations.

Note

B, C, D, E, and F are incorrect.




PreviousNext

Related