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 |
Difference between hashCode() & equals()?
What is mean by encoding?
What is arguments in java?
What do you mean by garbage collection used in java?
What is the multilevel inheritance. and also give the Example of it ?
What are the various access specifiers for java classes?
Can we declare the main method of our class as private?
Assume a thread has lock on it, calling sleep() method on that thread will release the lock?
Is java map thread safe?
What is a static method in java?
Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?
what do you mean by classloader?