Posted by : Rhyf Ahmad Thursday, May 21, 2015

Java uses exceptions as a way of signaling problems when you execute a program. Exceptions act as a control mechanism through which a program may be able to recover from an exceptional event. They provide important debug information (through stack traces) that help you figure what went wrong. Problems signaled by exceptions can be, but aren't always, serious (as I describe later in this chapter). The standard classes use them extensively.

Because they arise in your Java programs when things go wrong — and if something can go wrong in your code, sooner or later it will — they are a very basic consideration when you are designing and writing your programs.
The reason I've been sidestepping the question of exceptions for the past six chapters is that you first needed to understand classes and inheritance before you could understand what an exception is and appreciate what happens when an exception occurs. Now that you have a good grasp of these topics I can delve into how to use and deal with exceptions in a program.

Contents:

The Idea Behind Exceptions
Types of Exceptions
  1. Exceptions of Type Error
  2. Exceptions of Type RuntimeException
  3. Other Subclasses of Exception

Dealing with Exceptions
  1. Specifying the Exceptions a Method Can Throw
  2. Handling Exceptions
  3. The try Block
  4. The catch Block
  5. Catching Multiple Exception Types in a Block
  6. The finally Block
  7. Structuring a Method
  8. Execution Sequence
  9. Nested try Blocks
  10. Rethrowing Exceptions

Exception Objects
  1. The Throwable Class
  2. Standard Exceptions

Defining Your Own Exceptions
  1. Defining an Exception Class
  2. Throwing Your Own Exception
  3. An Exception Handling Strategy 




Ebook Preview
Get the ebook now (1.39 MB)

If the link above doesn't work, try the link below


Mirror: Get the ebook now (1.39 MB)

Leave a Reply

You can leave a comment to request any article(s), software(s), ebook(s) or report the dead link.
Then I will reply as soon as I can :)

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Recent Post

Recent Posts Widget
Instagram

- Copyright © Madriva -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -