What is Exception handling in Java
How do you handle run time errors please explain with an
example
Answer Posted / uv
Exceptions are handled by using "try","catch" and "finally"
block in the program.
The part of code which is suspected to give an exception is
kept under try block.
The exception is then been caught by the "catch" block. In
this way, we can avoid the abnormal termination of the
program and can also display some user friendly messages
which could guide them on how to refrain from exceptions.
finally block contains the code which is necessary to
execute like closing of connections established with
database while running the application.
finally block is always executed irrespective of the
exception.
| Is This Answer Correct ? | 16 Yes | 0 No |
Post New Answer View All Answers
What is data type modifier?
What does ide stand for?
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
What is variable in java?
Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)
What is a percentage sign called?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
What is memory leak and how does java handle it?
What is null data type?
What is meant by data hiding in java?
Can we have static methods in an interface?
Is singleton thread safe in java?
Can we inherit inner class?
Why put method is idempotent?
What is floor in java?