GeekInterview.com
Series: Subject: Topic:
Question: 1875 of 2109

What is the difference between exception and error


Answered by Scott on 2005-05-12 09:50:36: An Exception can be caught and recovered: ArrayIndexOutOfBoundsException means you tried to access a position of an Array that does not exist - no big deal. 
 
An Error is unrecoverable: OutOfMemoryError means that the JVM has no more memory to contin
Asked by: Interview Candidate | Asked on: May 12th, 2005
Showing Answers 1 - 11 of 11 Answers
Scott

Answered On : May 12th, 2005

An Exception can be caught and recovered: ArrayIndexOutOfBoundsException means you tried to access a position of an Array that does not exist - no big deal.  An Error is unrecoverable: OutOfMemoryError means that the JVM has no more memory to contin

  
Login to rate this answer.
syed abdul kather

Answered On : Dec 15th, 2006

Thanks for your answer

  
Login to rate this answer.
hari

Answered On : Dec 20th, 2006

Exception will give user friendly message which is defined in exception handling,whereas error message is standard given by oracle.

  
Login to rate this answer.
gayathri0904

Answered On : Jun 1st, 2010

View all answers by gayathri0904

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. In general error is which nobody can control or guess when it occurs.  Exception can be guessed and can be handled.

  
Login to rate this answer.
derrickinit

Answered On : Oct 31st, 2010

View all answers by derrickinit

Error: Any departure from the expected behavior of the system or program, which stops the working of the system is an error. In general error is which nobody can control or guess when it occurs. Exception: Any error or problem which one can handle and continue to work normally. 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 OutOfMemoryError 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.Note that in Java a compile time error is normally called an "error," while a runtime error is called an "exception."

  
Login to rate this answer.
Bijal

Answered On : Jul 21st, 2011

Exception:Exception can be handled.
Error:Error cannot be handled.

Exception:Exception do no terminate the program.
Error :Terminates the program

Yes  1 User has rated as useful.
  
Login to rate this answer.
alin20_84

Answered On : Feb 14th, 2012

View all answers by alin20_84

Also A method is not required to declare in its throws clause any subclasses of Error becuase this is an unchecked exception

  
Login to rate this answer.
vishnu

Answered On : Feb 24th, 2012

The exception class defines mild error conditions that your program encounters. Exceptions can occur when trying to open the file, which does not exist, the network connection is disrupted, operands being manipulated are out of prescribed ranges, the class file you are interested in loading is missing. The error class defines serious error conditions that you should not attempt to recover from. In most cases it is advisable to let the program terminate when such an error is encountered.

  
Login to rate this answer.
sreerenjini s

Answered On : May 18th, 2013

An exception is a condition that is caused by a run time error in the program .When the java interpreter encounters an error like division by zero,it creates an exception object and throws it.

  
Login to rate this answer.
sravani

Answered On : Jun 3rd, 2013

Exception is nothing but error but some difference whenever exception will raise program can execute continuously where as error program will not execute

  
Login to rate this answer.

Exception are abnormal conditions and errors are the mistakes like syntax error or logical error.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.