D3 Exceptions

278 views

Published on

What is exceptions?

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
278
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

D3 Exceptions

  1. 1. Exceptions Pakorn Weecharungsan
  2. 2. Contents  What are Exceptions?  The try Statement  The Exception Classes  The catch Cause  The finally Block  Throwing Exceptions
  3. 3. What are Exceptions?  An exception is a runtime error in a program. Examples are when a program tries to divide a number by 0.
  4. 4. The try Statement
  5. 5. The Exception Classes
  6. 6. The catch Clause  The catch clause handles exceptions. There are three forms, allowing different le vels of processing
  7. 7. The catch Clause
  8. 8. The finally Block  If a program’s flow of control enters a try statement that has a finally block, the finally bloc k is always executed  If no exception occurs inside the try block, then at the end of the try block, control skips over any catch claus es and goes to the finally block  If an exception occurs inside the try block, then any appropriate catch clauses in the catch clauses section are executed, followed by execution of the finally bloc k
  9. 9. The finally Block
  10. 10. Throwing Exceptions  You can make your code explicitly raise an exception by using the throw statement . The syntax for the throw statement is the following
  11. 11. Throwing Exceptions

×