Multiple Choice Question

Quiz Guidelines

 

QID: 
377
Question: 

Consider the following classes in one file named A.java...

abstract class A{   
protected int m1(){ return 0; } } 
class B extends A{   int m1(){ 
return 1; } }

Which of the following statements are correct...

Select 1 option 

A. The code will not compile as you cannot have more than 1 class in 1 file. 
B. The code will not compile because class B does not override the method m1() correctly. 
C. The code will not compile as A is an abstract class. 
D. The code will not compile as A does not have any abstract method. 
E. The code will compile fine. 

Q&A Set: