Which is the best way of exception handling?
Answer Posted / hari
instead of using try{}catch{} blocks throw an
ApplicationException and make suclass to that class and
extend RuntimeExceptions to ApplicationException class
public void read(String name)throws ApplicationException{
badurl(name);
numberFormate(name);
}
public void badUrl(String name)throws BadUrlException{
}
public void numberFormate(String name) throws
BadNumberException{
}
ApplicationException extends RuntimeException{
}
BadUrlException extends ApplicationException{}
BadNumberException extends ApplicationException{}
| Is This Answer Correct ? | 16 Yes | 1 No |
Post New Answer View All Answers
What is difference between checked and unchecked exception in java?
what is aggregation in java?
Where are the local variables stored?
In case of inheritance what is the execution order of constructor and destructor?
Differentiate between a class and an object.
What is the symbol for space?
How objects of a class are created if no constructor is defined in the class?
How does multithreading take place on a computer with a single cpu in java programming?
Why is an interface be able to extend more than one interface but a class can’t extend more than one class?
What is array length in java?
According to java operator precedence, which operator is considered to be with highest precedence?
How do I type unicode?
What is the difference between JDBC 1.0 and JDBC 2.0?
What is variable length arguments in java?
What is a platform?