Java

31
2450 reads

February 21, 2013

MultiCatch


This example depicts the multi-catch feature added in JDK 7.
In this example we have added two such statements in our try block:
line 11-> it generates Arithmetic Exception (division by 0)

36
2362 reads

February 21, 2013

Chaining Exceptions


This example demonstrates chaining of exceptions.

25
2456 reads

February 21, 2013

Creating Custom Exception Type


This example depicts how to create a custom exception type.We have created in class MyException which extends class Exception (line 2-15). In void main() we have added a catch block with a try block.

26
2712 reads

February 21, 2013

Throws


This example demonstrates throwing an exception.

30
2778 reads

February 21, 2013

Throw


This example demonstrates throwing an exception.

40
2268 reads

February 21, 2013

Method Nested Try


This example demonstrates that try statements can be implicitly nested via calls to methods.

35
2503 reads

February 20, 2013

Nested Try


This example demonstrates nested try statements.

35
2490 reads

February 20, 2013

Order of catch blocks


This example demonstrates 2 catch blocks and their order.

25
2384 reads

February 20, 2013

Multiple Catch Statements


In this example, we are trying to depict multiple catch blocks.

36
2412 reads

February 20, 2013

Displaying Exception Message


This example demonstrates the displaying of exception error message.