Home Java Exceptions Java Exceptions Tutorials With Examples
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Java Exceptions Tutorials With Examples

Advertisement
Exceptions are nothing but some anomalous conditions that occur during the execution of the program. Exceptions are the conditions or typically an event which may interrupt the normal flow of the program's instructions.

Java Exceptions Tutorials With Examples

     

  1. Exceptions in Java
    Exceptions are nothing but some anomalous conditions that occur during the execution of the program. Exceptions are the conditions or typically an event which may interrupt the normal flow of the program's instructions. 
      
  2. Exception Classes
    The hierarchy of exception classes commence from Throwable class which is the base class in java.lang. This class can be instantiated and thrown by the program. The Throwable class is further divided into two subclasses :- 
            
  3. Catching and Handling Exceptions
    The three exception handler components are used to catch and handle the exceptions. These are try, catch and finally clause. The mechanism to catch an exception in Java is to use try and catch block.
  4.     
  5. How to Throw Exceptions
    Before catching an exception it is must to be thrown first. This means that there should be a code somewhere in the program that could catch the exception.
  6.     
  7. Handling Multiple Catch Clauses
     In java when we handle the exceptions then we can have multiple catch blocks for a particular try block to handle many different kind of exceptions that may be generated while running the program.
  8.       
  9. Nested Try-Catch Blocks
    In Java we can have nested try and catch blocks. It means that, a try statement can be inside the block of another try.
      
  10. Catching Normal Exceptions
    The exceptions that are generated by methods are referred to as normal exceptions.  We have already learned that to catch an exception we use try and catch block.
  11.     
  12. Making Custom (User Defined) Exceptions
     
    If you encounter a situation where none of those exception describe your exception accurately or if you can't find the appropriate exception in the Java API, you can code a class that defines an exception that is more appropriate
  13.    
  14. What are Chained Exceptions
    Chained exceptions are the exceptions which occur one after another i.e. most of the time to response to an exception is given by an application by throwing another exception.
  15.      
  16. How to Print a Stack Trace Message
    Instead of this this method you can get more information about the error process if you print a stack trace from the exception using the printStackTrace() method that prints the stack trace to the console 
Advertisement

Liked it!  Share this Tutorial


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: March 18, 2008

Ask Questions?    Discuss: Java Exceptions Tutorials With Examples   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
rakesh
March 26, 2011
java lots of information basic and deeply

plese send me the java information,i am a bigner of java.
Shekhar Bhovad
April 17, 2011
Abstraction

What is oop?with defination 1)Abstraction 2)Encapsulation 3)Inheritance 4)Palomorphism and give example?
Al Roeder
April 18, 2011
JavaScript Catch Blocks

How many catch blocks can you have with each try block?
G.Anil goud
May 28, 2011
java

we need more informartion about Exception handling
Santosh Kumar Patel
June 25, 2011
C, C++,JAVA, .NET etc

I want to doing stronger our programming skill into basically JAVA and .NET etc.
suraj tiwari
June 12, 2013
java

java is a mostly useful lang
subrat kumar sethy
December 30, 2011
java

i want to knw abt java application
srinivas
January 5, 2012
java

i want java meterial
DMCA.com