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 awt and swing in java?
What are the features of swing in java?
Why are swings considered lightweight?
Hello Everyone.. I m trying to develop a java swing application where i can display a doc file Jeditorpane or Jtextpane.
What are swing controls?
What are the advantages of swing over awt?
What is an event and what are the models available for event handling?
What is awt and swing?
What are the advantages of swing?
What is the use of jcomponent class in swing?
What is difference between awt and swing?
What are the components of swing in java?
What is frame in java swing?
What is pane in swing?
What are swings awt?