Multiple Choice Question

Quiz Guidelines

 

QID: 
524
Question: 

What will be the result of attempting to compile and run the following program?

public class TestClass{
public static void main(String args[]){
Exception e = null;
throw e;
}
}

Select 1 option

A. The code will fail to compile.
B. The program will fail to compile, since it cannot throw a null.
C. The program will compile without error and will throw an Exception when run.
D. The program will compile without error and will throw
              java.lang.NullPointerException when run
E. The program will compile without error and will run and terminate without any output.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!