The Artima Developer Community
Sponsored Link

Java Buzz Forum
Difference between error and exception in java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
Difference between error and exception in java Posted: Aug 15, 2015 9:33 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: Difference between error and exception in java
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement
  • Exception and Error both are sub classes of java.lang.Throwable class.
  • We can handle Exceptions at runtime but Errors we can not handle.
  • Exceptions are the objects representing the logical errors that occur at run time and makes JVM enters into the state of  "ambiguity".
  • The objects which are automatically created by the JVM for representing these run time errors are known as Exceptions.
  • An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.
difference between error and exception handling

  Difference Between Exceptions and Errors

  • If exception occurs we can handle it by using try and catch block. If Error occurs we can handle it program execution need to be terminated.
  • In Exception we have two types
    1. Checked Exception
    2.Unchecked Exceptions
  • Error are by default unchecked exceptions.
  • Exceptions are related to application where ad Error are related to environment in which application is running.
  • Exception are of type java.lang.Exception
  • Errors are of type java.lang.Error
  • Error will run at run time.
  • In Exceptions Checked Exceptions will known to compiler so we need to handle these exceptions at compile time itself otherwise compile time Error will come.
  • Unchecked Exception will come at run time need to handle by using try and catch blocks.

Read More About Exceptions here:
  1. Exception Handling Introduction
  2. try catch finally in Java
  3. User Defined Exceptions in Java
  4. Throw vs throws 
  5. Final vs finally vs finalize()

Read: Difference between error and exception in java

Topic: Building models of Java code from source and JAR files Previous Topic   Next Topic Topic: Java Tutorial : Java Inheritance - Playlist

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use