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 swing gui?
Can a class be it?s own event handler? Explain how to implement this?
What is awt and swing?
What is the class in swing to change the appearance of the frame in runtime?
Where is java swing used?
What method is used to specify a container's layout?
What is the base class for all swing components?
Which package is needed for swing components?
What is a component in swing?
What is the use of java swing?
What is awt and swing in java?
Write a program to include the internal frame in swing.
How to render an html page using only swing.
How to generate bill in java swing?
What is import javax swing * used for?