Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is awt and swing in java?

971


What are the features of swing in java?

941


Why are swings considered lightweight?

1026


Hello Everyone.. I m trying to develop a java swing application where i can display a doc file Jeditorpane or Jtextpane.

2180


What are swing controls?

966


What are the advantages of swing over awt?

904


What is an event and what are the models available for event handling?

990


What is awt and swing?

973


What are the advantages of swing?

946


What is the use of jcomponent class in swing?

1047


What is difference between awt and swing?

1052


What are the components of swing in java?

969


What is frame in java swing?

1005


What is pane in swing?

948


What are swings awt?

929