When we write a program there are chances of coming across 2 different types of errors
- Compile-time Errors
- Run-time Errors.
An error which comes into picture at the time of program compilation is a compile-time error which may occur due to syntax mistakes. An error which occurs in the middle of the programs execution is known as a run-time error and these errors occur due to various reasons like wrong implementation of logic, wrong inputs supplied to a program, missing of required resources etc.
A compile-time error is not dangerous because it occurs at the time of compilation whereas run-time errors are dangerous because they occur in the program when the execution is going on and if at all a run-time error occurs in a program, the program terminates abnormally on the same line where the error gets occured without executing the rest of the code.
Note: Whenever an error situation occurs in a program the exception handler comes into picture to identify the type of error and then creates an object of an exception class associated with that error and throws that object and that object will first terminate the program abnormally and then displays an error message associated with an exception object.
No comments:
Post a Comment