What is the difference between an exception and an error?

Editorial / Best Answer

Answered by: Sameer

  • Apr 26th, 2006


Exception:Exception as the name suggests anything that is unusal.For e.g. if i try to delete a file which doesn't exist then it is an exception.

Error:Error is caused if something is wrong with the program.For e.g. a syntax error,logical error or runtime error.

Showing Answers 1 - 14 of 14 Answers

Poonam

  • Aug 13th, 2005
 

Error is a bug/fault in the system and exception is the case in case all the cases fails. 
Error is a failure and exceptions are the cases in case errors occur.

  Was this answer useful?  Yes

Aruna

  • Sep 7th, 2005
 

Exception is found by developer. 
Bug is found by testers. 
Error is found by Users.

  Was this answer useful?  Yes

VENKAT

  • Nov 21st, 2005
 

EXCEPTION :  Unexpected event or happening,not related to SRS

BUG: Related to SRS,Found by testers.

ERROR:not related to SRS.Found by users

  Was this answer useful?  Yes

Kishore Garnayak

  • Apr 17th, 2006
 

Exception is an programming fault which is caught by operating system.

Error is an anything which is not expected.

Sameer

  • Apr 26th, 2006
 

Exception:Exception as the name suggests anything that is unusal.For e.g. if i try to delete a file which doesn't exist then it is an exception.

Error:Error is caused if something is wrong with the program.For e.g. a syntax error,logical error or runtime error.

EXCEPTION: Any problem that can be handle by software is called exception.

ERRO: Any problem which can not handle by software like system get out of memmory is an error, and we can not fix it with software, is called ERROR.

  Was this answer useful?  Yes

Sujatars

  • Aug 15th, 2007
 


Exception is unexpected even which is meean to be handled by developers writing code.
Error is caused if something is wrong with the program or is a flaw in the system.

deepasree

  • Apr 28th, 2008
 

For ex : Web environment

Expection:
                    
I have a page named A, in that page i have a link also. If i click on the link the page B should be displayed in my screen...This is called as expectation

Error:

If i am clicking on the link present in the page named A , instead of viewing the page named B, if i get page C...Then it is an error

  Was this answer useful?  Yes

Error is which nobody can guess when it occurs.  Exception can be guessed and can be handled. 

In Java Exception and Error are sub class of Throwable.  It is differentiated based on the program control. Error such as OutOfMemory Error which no programmer can guess and can handle it.  It depends on dynamically based on architectire, OS and server configuration.  Where as Exception programmer can handle it and can avoid application's misbehavior.  For example if your code is looking for a file which is not available then IOException is thrown.  Such instances programmer can guess and can handle it.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions