how can u handle runtime exceptions in java plz explain
with examples briefly?

Answers were Sorted based on User's Feedback



how can u handle runtime exceptions in java plz explain with examples briefly?..

Answer / kamal

You can catch runtime exceptions in try catch block but
generally runtime exceptions are unchecked exceptions and
are not in control of a candidate to handle

Is This Answer Correct ?    21 Yes 10 No

how can u handle runtime exceptions in java plz explain with examples briefly?..

Answer / 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

how can u handle runtime exceptions in java plz explain with examples briefly?..

Answer / manish

You can catch compile time Exception,with using try and
catch or throws keyword,Buti think if u r going to catch
Runtime Exception then no,meaning bcoz Runtime Exception are
unchecked
exception.Means no meaning of try and catch but u can use.

Is This Answer Correct ?    15 Yes 9 No

Post New Answer

More Swing Interview Questions

What are the advantages of swing over awt?

0 Answers  


Explain the below Statement if(ae.getSource()==b1)

2 Answers   IPSG Systems, TCS,


What is event in java swing?

0 Answers  


What is the difference between invokeAndWait() and invokeLater()?

0 Answers  


What is swing container?

0 Answers  






What is jpanel in java swing with example?

0 Answers  


What is awt and swing in java?

0 Answers  


What is sling swing?

0 Answers  


How to perform action on button in java swing?

0 Answers  


Which swing methods are thread-safe?

0 Answers  


am searching for the job based on java, swing, currently working small company. they are not giving any salary slip, offer letter. so if i try outside for MNC's they start with previous company details. what should i do..? please help me to get job and make my career.

0 Answers   eClinicalWorks,


What are the advantage of swing over awt?

0 Answers  


Categories