how can u handle runtime exceptions in java plz explain
with examples briefly?
Answer Posted / ravibeli
We can handle runtime exceptions also. But it cost a lot to developer, he has to pay his attention to know exactly which are the list of exceptions can come the execution block.
Example:
public class OrderNotFoundException extends RunTimeException {
pulbic OrderNotFoundException(){
super();
}
pulbic OrderNotFoundException(String msg){
super(msg);
}
}
public Order getOrderDetailById(Long id) throws OrderNotFoundException {
try {
OrderDAO orderDao = new OrderDAO();
Order order = (Order)orderDao.getOrderById(id);
} catch (){
throw new OrderNotFoundException();
}
return order;
}
| Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of action interface in swing?
What is the process of setting the layout manager?
Why swings are used in java?
Is java swing a framework?
How to change button color in java swing?
What is swing framework in java?
What is the function of lightweight components used in swing?
What is swing components in java?
What is the difference between applications and applets?
Why swing is used in java?
When we should go for codebase in applet?
What are swing controls?
What is the difference between swing and awt?
Why are swings considered lightweight?
What is difference between awt and swing?