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
how many types of Inheritance?
What are jee technologies?
What are pass by reference and pass by value?
Is hashset ordered java?
What is string in java with example?
What is continuity of a function?
What is stringbuffer in java?
What is array size in java?
Why java is considered dynamic?
Why main() method is public, static and void in java ?
Can you sort a string in java?
What does opcode mean?
What is the difference between import java.util.date and java .util?
What is the maximum size of a string in java?
Define how destructors are defined in java?