try catch block in java | Exception handling in java
try catch block in java | Exception handling in java how to handle exception in java how to handle exception using try catch checked and unchecked exception in java Arithmetic exception in java Interrupted exception in java ===================================================================== #try 1. try is a keyword in java, used to write try block. 2. We write try block inside a method. 3. try block must be followed by either finally or catch block. 4. If exception occurs at the particular statement in the try block then the rest of the block code will not get execute, so we should not write code inside try block that do not throw an exception. ================================================================= #catch 1. It is a keyword in java, used to write catch block. 2. We can write it inside a method. 3. We should write exception handling code inside catch block. 4. Java catch block must be write after try block. 5. We cannot write catch block alone. 6. We can use multiple catch block with a single try block. 7. Whenever exception occurs, JVM checks whether exception handled or not. == If exception handled then the normal flow of the application is maintained, our program will not get terminate abnormally. == If exception not handled then the JVM provides exception object to the default exception handler, It will print exception description, exception class name, stack trace and our program will get terminate abnormally. ========================================================= #javaprogramminglanguage #trycatch #exceptionhandling #exceptionhandlinginjava #java #javatutorial #javaforbeginners
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.