Core Java - Interview Questions and Answers for 'Exceptions handling' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Exceptions handling' - 2 question(s) found - Order By Newest

 Q1. What is the purpose of re throwing the exception when we can provide the handling at the first catch itself ?Core Java2017-06-20 09:13:41

Ans. Sometimes the calls move across layers of classes and functions and hence each layer needs to perform some function like cleaning if something goes wrong deep inside.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     exceptions  exceptions handling  rethrowing exception


Related Questions



 Q2. Explain CloneNotSupportedException ?Core Java2019-02-02 17:26:10

Ans. If we do not mention, Cloneable Interface to the Class which we want to Clone then we get this exception, only if we try to clone an object

Like:
public class TestClone{
@Override
   protected Object clone() throws CloneNotSupportedException {
      return super.clone();
   }
}

In Main, You try to do:
TestClone clone = new TestClone();
      
      TestClone clone2 = (TestClone) clone.clone();

You will get CloneNotSupportedException.

Just add -> public class TestClone implements Cloneable {

and things are fixed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     exceptions handling  cloning


Related Questions

 What is the purpose of re throwing the exception when we can provide the handling at the first catch itself ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: