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



What is the need of "creating and throwing an UserdefinedException" when the "Except..

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

What is the need of "creating and throwing an UserdefinedException" when the "Except..

Answer / sri

if you want you could specify your own exception that you
know is gonna happen otherwise it is recommended to handle
the exception through exception class in catch block.

Is This Answer Correct ?    1 Yes 0 No

What is the need of "creating and throwing an UserdefinedException" when the "Except..

Answer / guru

user defined exception is used throwing out(user) own
exception..

Is This Answer Correct ?    0 Yes 0 No

What is the need of "creating and throwing an UserdefinedException" when the "Except..

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

Post New Answer

More Core Java Interview Questions

Difference between hashCode() & equals()?

3 Answers   HCL,


What is mean by encoding?

0 Answers  


What is arguments in java?

0 Answers  


What do you mean by garbage collection used in java?

0 Answers  


What is the multilevel inheritance. and also give the Example of it ?

5 Answers  






What are the various access specifiers for java classes?

0 Answers  


Can we declare the main method of our class as private?

0 Answers  


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

0 Answers  


Is java map thread safe?

0 Answers  


What is a static method in java?

0 Answers  


Difference between doublesummarystatistics, intsummarystatistics and longsummarystatistics ?

0 Answers  


what do you mean by classloader?

0 Answers  


Categories