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

 
 

Share on Google+Share on Google+
SCJP Module-6 Question-2
Posted on: July 12, 2010 at 12:00 AM
Advertisement
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 .

Advertisement

Related Tags for SCJP Module-6 Question-2:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 12, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com