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
Is string a class in java?
What is meant by data hiding/encapsulation?
Can we create an object of private class?
What is the difference amongst jvm spec, jvm implementation, jvm runtime ?
What advantage do java's layout managers provide over traditional windowing systems?
What is data movement?
Write a function to print Fibonacci series and Tribonacci series?
What is wrapper class html?
Will the jvm load the package twice at runtime?
What is the static variable?
How does arraylist work in java?
What is the size of integer?
How do you square a number?
What is a jit compiler?
What is classpath?