Getsuyodev, Programming is mainly used when constructing an application. Programming requires knowledge of application domains, algorithms, and programming language expertise. Programming can be developed in different logic based on developer knowledge.

Difference between Exception and Error



Exception and Error

Exceptions are those which can be handled at the run time whereas errors cannot be handled.

An exception is an object of a type deriving from the System — exception class. SystemException is thrown by the CLR (Common Language Runtime) when errors occur that are nonfatal and recoverable by user programs. It is meant to give you an opportunity to do something with throw statement to transfer control to a catch clause in a try block.

Exception syntax:

 try
  {
	  //write your code here
  }
  Catch (exception type)
  {
	  //writ your code here
  }

An Error is something that most of the time, you cannot handle it. Errors are the unchecked Exception, and the developer is not required to do anything with these. Errors usually tend to signal the end of your program; it typically cannot be recovered from and should cause you to exit from the current program. It should not be caught or handled.
All the Errors are Exceptions, but the reverse is not true. In general, Errors are which nobody can control or guess when it happened; on the other hand, Exception can be guessed and can be handled.


Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More