Exception Handling in Programming | Tackle Unnecessary Errors while Running

Exception Handling in Programming | Tackle Unnecessary Errors while Running

What is meant by Exception Handling?

Sometimes while running an application some unnecessary conditions are arise which logically not possible so those situations are not understand by the compiler and it throws an error while running and stop the program in between and show some error which will look an inappropriate to the user who are using. So to tackle/ handle these types of situations we kept those in a separate block so while running if they throw the error. To handle these types of exception we use 'try{}, catch{}, final{}' block in a program which helps the compiler to understand which block of code will throw the exception. Let's understand with the help of one example suppose you have developed a program, which takes input of the two number through the user and divide it and print it on the screen. So if any user input 7 on the first input field and 0 to the second input field then then it'll throw some error because it is not possible logically. So if you put the divide method in the try block it will not stop the flow of the code and skip that piece of code with appropriate message and doesn't affect the flow of code.


Last updated:7/1/2021 7:09:44 AM
Anonymous User

Anonymous User

I am a content writter !

0 Comments

Leave Comment