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 import javax swing * used for?
What is the use of jcomponent class in swing?
Why swing is better than awt?
Why swings are used in java?
What is the difference between invokeAndWait() and invokeLater()?
What is container in java swing?
What is the difference between swing and awt in java?
How to render an html page using only swing.
What is Java Swing?
What is java swing package?
How to reload a jframe in java swing?
Which package is needed for swing components?
Explain the difference between awt and swt.
How to perform action on button in java swing?
What are the containers available in swing?