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
Hello Everyone.. I m trying to develop a java swing application where i can display a doc file Jeditorpane or Jtextpane.
Why are swing components called lightweight components?
Is swing still used?
How to add calendar in java swing using eclipse?
Which window contains the swing controls?
What is java swing package?
Is swing an api?
What are differences between swing and awt?
What are the components of swing?
What is difference between awt and swing?
What is a component in swing?
What is swing and its features in java?
What is the process of setting the layout manager?
What is the purpose of serialization in swings?
What are the containers available in swing?