A java exception can be thrown only in the following three scenarios: (1) An abnormal execution condition was synchronously detected by the Java virtual machine. - When evaluation of an expression violates the normal semantics (Example: an integer divide by zero) - An error occurs in loading or linking part of the program - When [...]
Type of exceptions in java are checked exceptions and unchecked exceptions. This classification is based on compile-time checking of exceptions. There is also a classification based on runtime in java. It is not widely known! That is synchronous and asynchronous exceptions. First let us see the java checked exceptions and unchecked exceptions. Checked Exceptions Vs [...]
The finally clause in the try-catch exeception block always executes, irrespective of the occurence of exeception. This is applicable for the normal java program flow. If the execution flow is stopped irreversibly before the finally clause, then the finally block will not be executed. How can the user achieve that in Java? Include “System.exit(1);” before [...]