Core Java - Interview Questions and Answers for 'Error 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 'Error handling' - 2 question(s) found - Order By Newest

 Q1. Which of the following exception is thrown when we try to access element which is beyond the size ?

a. NullPointerException
b. ArrayIndexOutOfBoundException
c. ArithmeticException
d. ParseException
Anonymous
Ans. ArrayIndexOutOfBoundException

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

   Like         Discuss         Correct / Improve     java   exceptions   error handling


Related Questions

  What things should be kept in mind while creating your own exceptions in Java?
  Explain java.lang.OutOfMemoryError ?
  How compiler handles the exceptions in overriding ?
 What will happen if we don't have termination statement in recursion ?
  Name few Java Exceptions ?
  How can we make sure that a code segment gets executed even in case of uncatched exceptions ?
  Is it necessary that each try block to be followed by catch block ?
  What is exception propogation ?
  Can we have try and catch blocks within finally ?


 Q2. Can we catch errors in Java ? Core Java2017-05-23 08:21:10

Ans. Yes we can

try {
// code
} catch (Error ex) {
// handling code
}

but we shouldn't ideally do that as errors are mostly JVM based and not application based and there is rarely we can do something about it. Very likely catching and not re throwing would lead to muting their response or trace.

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

   Like         Discuss         Correct / Improve     exception handling  error handling  errors     Asked in 1 Companies      intermediate


Related Questions

  Explain java.lang.OutOfMemoryError ?
  When do you get ClassCastException?

or

What is ClassCastException ?
  How can we manage Error Messages in the web application ?
  Will this code give error if i try to add two heterogeneous elements in the arraylist. ? and Why ?
  What are some different logging levels for log4j ?
  If we try to add duplicate key to the HashMap, What will happen ?
  Which of the following exception is thrown when we try to access element which is beyond the size ?
 How Java 9 would help resolve NoClassDefFoundError through it's modularity ?
 Why doesn't this code give compile time error when we are clearly trying to add an integer element to an array of Strings

Object[] strArray = new String[2];
strArray[0] = 5;
 What would you do if you see an error thrown by a lambda function as "Access Denied" while doing something with S3 ?



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: