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 backdrop?

0 Answers   Atos Origin,


How can we create objects if we make the constructor private ?

0 Answers  


Can we make a constructor final?

0 Answers  


Which is better ascii or unicode?

0 Answers  


A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.

0 Answers  






how to accept integer array in java

2 Answers   Tech Guru,


Map map = new HashMap(2); map.add(“1”,”one”); map.add(“2”,”two”); map.add(“3”,”three”); What will happen at this line?

5 Answers   Rolta,


suppose in a class there is a code like this: { Set hs=new Hashset(); hs.add(new Emp("kathy",1000)); hs.add(new Emp("kathy",2000)); } how can u avoid the above code in your class as set won't allow duplicate objects?

3 Answers  


What is merge sort in java?

0 Answers  


After compilation of java program we'll get .class code. If it's generated in OS Windows XP will it work on OS Linux? If yes why? If no why?

5 Answers   Aricent,


In real time project which driver did u use? What is the main functionality of the Prepared Statement?

3 Answers   Photon,


What are anonymous inner classes?

0 Answers  


Categories