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 null data type?
How we can skip finally block of exception even if some exception occurs in the exception block in java?
What are the uses of synchronized keyword?
What are the limitations of procedural programming approach?
what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent
What are java annotations?
What is a package in java? List down various advantages of packages.
What are the kinds of polymorphism?
What is method overriding in java ?
What about main() method in java ?
Explain the importance of finally over return statement?
What is a Hash Table? What are the advantages of using a hash table?
What is variable and its types?
What language is java written?
Difference between this() and super() ?