What is the need of "creating and throwing an
UserdefinedException" when the "Exception" class is already
available?
Answers were Sorted based on User's Feedback
Answer / vinayakkatkar
There are some exceptions that are not defined by java api
ex- invalid age exception ,invalid number exception etc.
in user defined exceptions are raised by programmer,
thrown by programmer ,handled by programmer
while predefined exceptions are raised by system,
thrown by system
handled by programmer
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / guru
user defined exception is used throwing out(user) own
exception..
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / seshadri pera
UserDefindException are thrown and handled based on the
user requirements to make sure the particular exception
conditions intead of throwing the general exception for all
the exceptions.
We should handle the specific exception first by using
catching it instead of handling generic exceptions of type
Exception.
| Is This Answer Correct ? | 0 Yes | 1 No |
What is var keyword ?
What is difference between jdk,jre and jvm?
I want to print “hello” even before main is executed. How will you acheive that?
write a class to input 2 points by the user & check the line maked by the points is horizontal,vertical or rectangle?
What does pointer mean?
Can an integer be null java?
How many types of methods are there?
What class allows you to read objects directly from a stream?
can you create interface instance ?
In Java, what are public static void main string args?
Can we write any code after throw statement?
Are nested try statements are possible?