Runtime exceptions represent problems that are the result of a programming problem. Such problems include arithmetic exceptions, such as dividing by zero; pointer exceptions, such as trying to access an object through a null reference; and indexing exceptions, such as attempting to access an array element through an index that is too large or too small. Runtime exceptions need not be explicitly caught in try catch block as it can occur anywhere in a program, and in a typical one they can be very numerous. Having to add runtime exceptions in every method declaration would reduce a program's clarity. Thus, the compiler does not require that you catch or specify runtime exceptions (although you can). The solution to rectify is to correct the programming logic where the exception has occurred or provide a check.
Java
Topic: Exceptions
What is Runtime Exception or unchecked exception?
Browse random answers:
What is an Exception?
What is a Java Exception?
What are the different ways to generate an Exception?
Where does Exception stand in the Java tree hierarchy?
Is it compulsory to use the finally block?
How are try, catch and finally block organized?
What is a throw in an Exception block?
What is the use of throws keyword?
What are Checked Exceptions and Unchecked Exceptions?
What are Chained Exceptions?
Exceptions are defined in which java package?
What is Runtime Exception or unchecked exception?
What is difference between ClassNotFoundException and NoClassDefFoundError?
How to create custom Exception?
Why did the designers decide to force a method to specify all uncaught checked exceptions that can be thrown within its scope?
Can you give an example of an unrecoverable problem when error is thrown?
Explain the difference between the two approaches of exception handling