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
Is java swing a framework?
What are the components of swing in java?
What is swing in java javatpoint?
What are the differences between Swing and AWT?
What's java swing?
What is an on stage swing?
Why should the implementation of any swing callback (like a listener) execute quickly?
How to create a swing gui in java?
What are swing components?
What are the swing components in java?
What is the difference between applications and applets?
Why should any swing call back implementation execute quickly?
Is swing better than awt?
What is javax swing joptionpane?
What are differences between swing and awt?