Logo F2FInterview

Java Basics Interview Questions

Q   |   QA

Runtime exceptions are those exceptions that are thrown at runtime because of either wrong input data or because of wrong business logic etc. These are not checked by the compiler at compile time.

An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error.

These JVM errors and you can not repair them at runtime. While exceptions are conditions that occur because of bad input etc. Example: FileNotFoundException will be thrown if the specified file does not exist. Or a NullPointerException will take place if you try using a null reference.

In most of the cases it is possible to recover from an exception (probably by giving user a feedback for entering proper values etc.).

Your class should extend class Exception, or some more specific type thereof.

The class should extend from Exception class. Or you can extend your class from some more precise exception type also.

One can not do anytihng in this scenarion. Because Java does not allow multiple inheritance and does not provide any exception interface as well.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: