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 a superclass?
What is the Concept of Encapsulation in OOPS
Is java programming easy?
What is difference between float and double?
How to sort array of 0 and 1 in java?
How many bytes is a url?
Can you explain the meaning of aggregation and composition
What is mnemonic code?
Explain spliterator in java8?
Is java se free?
What is the default value of byte datatype in java?
What is difference between protected and private?
Define array. Tell me about 2-D array.
What are the problems faced by java programmers who don't use layout managers?
What is a constructor, constructor overloading in java?