Back to Top

Saturday, 21 January 2012

JAVA: What is the difference between error and an exception?

In Java, under Throwable class, there are 2 sub-classes named Exception and Error.

Exception class:
  •  It is used for exceptional conditions that user programs should catch.
  •  It's also the class that you will sub-class to create your own custom exception types.
  •  For example, NullPointerException will be thrown if you try using a null reference.
Error class:
  •  It indicates serious problems that a reasonable application should not try to catch.
  •  It's used by the Java run-time system to indicate errors having to do with the run-time environment, itself.
  • For example, stack overflow is an error.

4 Responses to “ JAVA: What is the difference between error and an exception? ”

Prasadarao Kuchipudi said...
16 November 2013 at 02:05

how to handle the error in application?

Naviya Nair said...
24 October 2016 at 15:12

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai

calfre services said...
3 August 2018 at 15:52

Definitely it will be useful for many people. So please keep update like training

sumant kumar said...
29 August 2018 at 18:25

I found best article.thank you for sharing useful info.
web programming tutorial

Post a Comment

Popular Posts

Subscribe via Email
Subscribe Java Interview Questions via Email
All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar
blog links Web Directory Academics Blogs