Checked Exception vs. Runtime Exception

Difference Between Checked Exception and Runtime Exception

Exceptions are the type of special events, which can unsettle the normal sequence of program. Exception comes from the name of ‘ special event ‘. To throw an exception is the process of creation of an object of exception and to delay it in the system of execution. When the system of execution accepts the object of exception, it is going to try to find somebody to be in charge of it within the pile of call by crossing it in the inverse order (in which methods was called). The system of execution is achieved if it finds a method with an administrator of exception. Administrator of exception is a block of code which can manage exception officially declared. If the system of execution finds an appropriate administrator, it is going to cross the object exception to the administrator. It is what they call interception of exception. However exception program cannot be manipulated and ended. In Popular dance, exceptions inherit from the class Throw able. Proved exceptions are exceptions on which manipulation is carried out by the compiler. Exceptions of execution are a type of exceptions, which are not proved by the compiler.

What is a proved exception?

Proved exceptions or objects belong to the java.lang. Exception classifies or its subclasses (except the in java.lang. Runtime Exception and the subclasses). Proved exceptions are ‘proved’ at the time of compilation. It means that the programmer owes is taken or thrown in these exceptions, otherwise compilation complain (causing an error of compilation). Owing to this reason, numerous proved exceptions are very well known by the programmers. For instance, IO Exception and its subclasses exceptions is proved, and each time the programmer is dealing with to achieve or changing a file, the compiler proves that all possible IO Exceptions should betaken care by the programmer.

What is an exception of execution?

Exceptions of execution command of java.lang. Runtime Exception and all classes under sound are always there. Theoretically speaking, they serve the same purpose as proved exceptions, and can be thrown or treated as proved exception, but manipulation of them is not applied by the compiler. As a result, the exceptions of execution belong to the family of not proved exceptions. Null Pointer Exception, Number Format Exception, Class Cast Exception and Array Index out Of Bounds Exception are common exceptions of execution of popular program.

What is difference between proved exception and Runtime Exception?

Although, at the same time proved exceptions and exceptions of execution is undesirable but can happen during the execution of a program and they can have their difference. The management of proved exceptions is applied by the compiler, but exceptions of execution are not. As a result, proved exceptions must be thrown or manipulated so that the code to be compiled, but it not such required concerning exceptions runtime. As a result, the exceptions of execution belong to the unbridled category of exceptions of the long with errors.

Disadvantage with proved exceptions, it is that the programmer has manipulate it, even if she does not know how. Therefore, if the programmer throws a new exception simply without packing of origin, the trace of the pile belonging except for origin will be lost. It is there that exceptions of execution to come in easy to handle. Because all exceptions of execution can be treated as the single place, therefore the programmers can write less than the quantity of code. On the other hand, since proved exceptions must be taken, it’s no surprise for the programmer. She will always know when proved exception can be thrown by a certain method. Contrary to it, various exceptions of execution are able to be thrown without knowledge of the programmer.




Category: VS  |  Tags: