Multiple Choice Question

Quiz Guidelines

 

QID: 
530
Question: 

What will the following code print when compiled and run?

abstract class Calculator{   
abstract void calculate();   
public static void main(String[] args){      
System.out.println("calculating");      
Calculator x = null;     
 x.calculate();   } }

Select 1 option 

A. It will not compile. 
B. It will not print anything and will throw NullPointerException 
C. It will print calculating and then throw NullPointerException. 
D. It will print calculating and will throw NoSuchMethodError 
E. It will print calculating and will throw MethodNotImplementedException 

Q&A Set: