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

 
 

Share on Google+Share on Google+
SCJP Module-6 Question-22
Posted on: July 15, 2010 at 12:00 AM
Advertisement
The program code given below will Check your knowledge of handling Exception in Java.

Given below the sample code :

class main{
try {
int a= Integer.parseInt("three");
}
}

Which exception could be handeled by the catch block for above ?

1.  ClassCastException

2.   IllegalStateException

3.   NumberFormatException

4.  IllegalArgumentException

5.  ExceptionInInitializerError

6.  ArrayIndexOutOfBoundsException


Answer

(3) & (4)

Explanation

Above code throws "NumberFormatException" ." IllegalArgumentException" is its superclass.

Advertisement

Related Tags for SCJP Module-6 Question-22:


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 15, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com