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 java swing application?
Write a program to paint the off-screen buffer in swings
What are the various components of swing?
What is swing package in java?
What is an event and what are the models available for event handling?
What are swing components?
Why would you use swingutilities.invokeandwait or swingutilities.invokelater?
What is jlabel java swing?
What are heavy weight components ?
What is java swing used for?
What are the different types of layout managers used in swing?
What is Java Swing?
In what context should the value of swing components be updated directly?
What are the features of swing in java?
What is the what is the difference between invokeandwait() and invokelater()? ?