Search unanswered questions...
Enter a question here...
Questions Reference

Why would you want to use user defined exception handling?

[Edit]

Answer

suppose u want to catch an exception which is not define by java. for example suppose u want that when use enter the value in password foeld if the value doesnot matches the user's actual password then it will generate an error.To catch this error u can create a subclass of throwable class and catch this.Whenever user try to enter the wrong password the exception is generated and the statements written in catch block is fired.

like this try { this.checkUser(); MainScreen screen = new MainScreen(); dispose(); } catch (InvalidUserException invl) { JOptionPane.showMessageDialog(this, "Invalid User or Password","FastSign Java", JOptionPane.ERROR_MESSAGE); psw_user.requestFocus(); psw_user.setText(""); }

Answer

suppose u want to catch an exception which is not define by java. for example suppose u want that when use enter the value in password foeld if the value doesnot matches the user's actual password then it will generate an error.To catch this error u can create a subclass of throwable class and catch this.Whenever user try to enter the wrong password the exception is generated and the statements written in catch block is fired.

like this try { this.checkUser(); MainScreen screen = new MainScreen(); dispose(); } catch (InvalidUserException invl) { JOptionPane.showMessageDialog(this, "Invalid User or Password","FastSign Java", JOptionPane.ERROR_MESSAGE); psw_user.requestFocus(); psw_user.setText(""); }

from chandan Kumar(Soft.. Engineer in Animon Software Solutions,New Delhi) (chandanparida@yahoo.co.in)

Improve Answer Discuss the question "Why would you want to use user defined exception handling?" Watch Question

First answer by ID3537086609. Last edit by ID3537086609. Question popularity: 67 [recommend question]

Research your answer:

Answers.com > Wiki Answers > Categories > Technology > Computers > Why would you want to use user defined exception handling?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
Exception handling in c?  What is obection handling?  What is exception handling?  User Define Exception in java?  Exception handling in programming?  What is 'exception handling' in c?  Example of user defined exception?  A note on Exception handling with example?  How is exception handling carried out in C?  What is the need of user defined exceptions?  Which header-file is used in exception handling in C?  In what situation will go for user defined exception?  Examples for user defined exception class in java and how to use it?