Life long sharing . . .

Java – Exception

Posted on: December 31, 2015

Here is a summary from the Tutorials Point website.

Lesson13-note1

Three Types of Exceptions: (Checked exceptions, Unchecked exceptions, Errors)

Lesson13-note2

If you try to compile the below program, what will you get?

Lesson13-code1

Lesson13-note3

Try compile the below codes. Do you get any exception?

Lesson13-code3

Try execute the codes. What do you get?

Lesson13-note4

Here is the hierarchy of exception classes in Java:

Lesson13-note5

Here is the list of commonly used/encountered Java Unchecked (Runtime) exceptions:

Lesson13-list1

Here is the one for Checked exceptions:

Lesson13-list2

Lesson13-note6

Lesson13-note7

Try compile and execute the below codes. What is the output?

Lesson13-code6

Lesson13-note9

Try the below codes. What is the output?

Lesson13-code7

Lesson13-note11

Study the below codes:

Lesson13-code8

Lesson13-note12

Lesson13-note8

 

Source: http://www.tutorialspoint.com/java/java_exceptions.htm

Advertisements

1 Response to "Java – Exception"

FileNotFoundException

ArrayIndexOutOfBoundsException

Access element three :3
Arithemtic exception: / by zero
Out of the block

Exception thrown :java.lang.ArrayIndexOutOfBoundsException: 3
First element value: 6
The finally statement is executed

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives

December 2015
M T W T F S S
« Nov   Jan »
 123456
78910111213
14151617181920
21222324252627
28293031  

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 180 other followers

%d bloggers like this: