Home Tutorial Java Scjp Part6 SCJP Module-6 Question-2

 
 

SCJP Module-6 Question-2
Posted on: July 12, 2010 at 12:00 AM
The given program below will test your knowledge on Exception in Java programing language.

Given below the sample code :

1.  class SuperClass{

2.  public void Function(Ingredient[] list) throws XXX

3.  {

    //body of the Function

N.  } }

The code above throws two exceptions ' ArrayIndexOfBoundException ' ,  ' NullPointerException '.Which given below statement can replace  line number 3 ?

1. public void Function(Ingredient[] list) throws BaseException

2. public void Function(Ingredient[] list) throws ArrayIndexOfBoundException, NullPointerException

3. public void Function(Ingredient[] list) may throw NullPointerException 

4. public void Function(Ingredient[] list)

Answer :

(1) &(2)

Explanation :

BaseException is more general than ArrayIndexOfBoundException or NullPointerException .

Related Tags for SCJP Module-6 Question-2:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.