Home Tutorial Java Scjp Part2 SCJP Module-2 Question-17


Share on Google+Share on Google+
SCJP Module-2 Question-17
Posted on: July 8, 2010 at 12:00 AM
This program heps in understating of Java, makes your concepts and clear and also helps in preparation of SCJP examination.

What exception is raised by the following code :

public class Example17 {
static String str = "";
public static void main(String[] args) {
try {
str += "an";
throw new Exception();
} catch (Exception e) { s += "k";
} finally { str += "i"; calculate(); str += "t";
static void calculate() { int x = 0; int y = 7/x; }

What exception is raised by the following code :

1.no exception is raised by the code.

2. java.lang.ArithmeticException

3. class not found Exception.

4. null pointer exception

Answer :


Explanation :

Because the "calculation()"  method has a illegal Expression i.e. y=7/x , due to this method "ArithmeticException" is raised.


Related Tags for SCJP Module-2 Question-17:

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

Recommend the tutorial

Advertisements Advertisements