Java OCA OCP Practice Question 2776

Question

Given:.

2. abstract interface Printable {  
3.   abstract void print();  
4.   static int dust = 3;  
5. }  //from   www  .j a va 2  s.  c  o  m
6. abstract class Shape implements Printable {  
7.   String log() { return "message "; }  
8. }  
9. public class Main extends Shape {  
10.   public static void main(String[] args) {  
11.     new Main().print();  
12.   }   
13.   public void print() { System.out.println(log() + " " + dust); }    
14. } 

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

  • A. message 3
  • B. Compilation fails because Shape doesn't properly implement Printable.
  • C. Compilation fails because Main doesn't properly extend Shape.
  • D. Compilation fails because Printable is not a legal interface.
  • E. Compilation fails because Main doesn't properly implement Printable.
  • F. Compilation fails because Shape is not a legal abstract class.


A is correct

Note

All of the declaration, implementing, and extending rules are satisfied.




PreviousNext

Related