1. Can You catch the Error? 2. Difference between compiletime exception and runtime exception?3. How you throw user defined exception?4. How you handle throwable while using exceptions ?5. What are the methods available in Object ?6. Is there any methods available in serialization ?7. How you seralize an Object ?8.How you get the serialized object ? 9. Any methods available in deseralization ?

Questions by sudhakar_bvr   answers by sudhakar_bvr

Showing Answers 1 - 8 of 8 Answers

Rohit Sachan

  • Jun 1st, 2006
 

1. No U can not catch the error.2. Error like stack over flow at run time which is diffrent from Exceptions exception are like the will come every time as in general there is sth wrong in your code, this kinda error will happen at run time depends on that perticular situation.

  Was this answer useful?  Yes

Klasseic

  • Jun 12th, 2006
 

Error exceptions indicate a very serious problems that are usually unrecoverable and should never be caught. Its not a good idea to catch Error exceptions by 'try-catch' blocks.

But 'finally' clause will always be executed when any exception-including 'Error' exceptions- comes up in the call stack, so you can always clean up after any exception.

Klasseic

  • Jun 12th, 2006
 

2. Runtime exceptions are  exceptions that extends the RuntimeException class and are called unchecked exceptions.

Compiler checks only the checked exceptions meaning, that your method throws only those exceptions that they have declared themselves to throw.Unchecked exceptions are thrown during runtime and are not checked by compiler, which extends the 'Exception' class but not 'RuntimeException' class.

  Was this answer useful?  Yes

kripa

  • Aug 24th, 2006
 

it would be better to use a 'try-catch' block.

  Was this answer useful?  Yes

santosh dash

  • Feb 1st, 2007
 

who tells no? we can catch errros by try/catch block.but it is advisible not to handle errors.every subclass of Throwable can be handled.

  Was this answer useful?  Yes

ambuj

  • Jun 28th, 2007
 

No, because error is not related to ur progamming envirnment through which we can apply our exception handling mecanism. It occurs only due to operating system failure, System virus affected etc.

  Was this answer useful?  Yes

Yes, you can catch the Error as it is a subclass of Throwable, but you are not supposed to.
For most of the errors like ( out of memry), there is no use of catching the error.

MAHES

  Was this answer useful?  Yes

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