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 java swing application?

954


Write a program to paint the off-screen buffer in swings

967


What are the various components of swing?

925


What is swing package in java?

927


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

950


What are swing components?

1038


Why would you use swingutilities.invokeandwait or swingutilities.invokelater?

935


What is jlabel java swing?

957


What are heavy weight components ?

1014


What is java swing used for?

951


What are the different types of layout managers used in swing?

934


What is Java Swing?

1013


In what context should the value of swing components be updated directly?

890


What are the features of swing in java?

907


What is the what is the difference between invokeandwait() and invokelater()? ?

1059