Java Exceptions


  1.  Base class of errors and Exceptions is Throwable class .
  2. finally block in Exception is always executed  .
  3. finally block will not if program exits (System.exit(0); ) or causing a fatal error that causes the process to abort .
Exception Propagation :- It is used to forwarding the exception object to the invoking method is known as exception propagation .

Comparison between throw and throws :-
 
 throw  throws
  •  it is used to explicitly throw an exception .
  •  It is used to declare an exception .
  • checked exception cannot propagated with throw only.
  • checked exception can be propagated with throws.
  • throw is followed by an instance .
  • throws is followed by class.
  • it is used in method .
  • It is used with the method signature .
  • can declare multiple exceptions .(throws IOException , SQLException ) .


No comments:

Post a Comment

Optimize your Programming Skills

  Java is The most Powerful Programming Language , Because of it's Oops Concept and it's Compilation Process . After The Compilatio...