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

What is var keyword ?

1 Answers   Wipro,


What is difference between jdk,jre and jvm?

1 Answers  


I want to print “hello” even before main is executed. How will you acheive that?

1 Answers  


write a class to input 2 points by the user & check the line maked by the points is horizontal,vertical or rectangle?

1 Answers  


What does pointer mean?

1 Answers  


Can an integer be null java?

1 Answers  


How many types of methods are there?

1 Answers  


What class allows you to read objects directly from a stream?

1 Answers  


can you create interface instance ?

54 Answers   Fidelity, TCS,


In Java, what are public static void main string args?

2 Answers  


Can we write any code after throw statement?

1 Answers  


Are nested try statements are possible?

2 Answers  


Categories