Java - Interview Questions and Answers for 'Error' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Error' - 15 question(s) found - Order By Newest

 Q1. Explain java.lang.OutOfMemoryError ?
Core Java
Anonymous
Ans. This Error is thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.

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

   Like      Discuss      Correct / Improve     java   exceptions   jvm   outofmemoryerror


 Q2. When do you get ClassCastException?
Anonymous
Ans. As we only downcast class in the hierarchy, The ClassCastException is thrown to indicate that code has attempted to cast an object to a subclass of which it is not an instance.

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

   Like      Discuss      Correct / Improve     java   oops   class casting   classcastexception   exception   error      intermediate        frequent

Try 2 Question(s) Test


 Q3. 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


 Q4. What will happen if static modifier is removed from the signature of the main method?
Admin
info@buggybread.com
Ans. Program throws "NoSuchMethodError" error at runtime .

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

   Like      Discuss      Correct / Improve     java   main method   main   static   static method   nosuchmethoderror


 Q5. Tell me something about AssertionError ?Core Java
Admin
info@buggybread.com
Ans. AssertionError is actually a fatal fault or a bug in the program. We may not like to continue program , request or thread execution if this error occurs as this condition is the assumption to continue further execution.

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

   Like      Discuss      Correct / Improve     java   error   exceptions   exception handling   assertion error   assertionerror


 Q6. Will this code compile ?

public class BuggyBread1{
abstract public void test();
}
Core Java
Admin
info@buggybread.com
Ans. No. It will give the compilation error saying "The abstract method test in type BuggyBread1 can only be defined by an abstract class".

We need to declare the class abstract for it to have any abstract method.

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

   Like      Discuss      Correct / Improve     java   oops   abstract class   abstract methods   java compilation error


 Q7. Will this Code compile ?

abstract public class BuggyBread1{
abstract public void test(){};
}
Core Java
Admin
info@buggybread.com
Ans. No. This will give a compilation error saying "Abstract methods do not specify a body".

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

   Like      Discuss      Correct / Improve     java   abstract classes   abstract methods   java compilation error   java coding   java code   coding   yes-no


 Q8. What are some different logging levels for log4j ?Log4j
Admin
info@buggybread.com
Ans. DEBUG
ERROR
ALL
WARN
INFO
FATAL
OFF
TRACE
TRACE_INT
WARN

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

   Like      Discuss      Correct / Improve     java   log4j   log4j level   logging   error logging


 Q9. Name few Error and Exception classes provided by Java ?
Admin
info@buggybread.com
Ans. http://www.buggybread.com/2015/01/java-list-of-error-exception-classes.html

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

   Like      Discuss      Correct / Improve     java   exceptions   error



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. What is OutOfMemoryError in Java?Core Java
admin
info@buggybread.com
Ans. OutOfMemoryError in Java is a subclass of VirtualMachineError and is thrown by JVM when it runs out of heap memory.

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

   Like      Discuss      Correct / Improve     outofmemoryerror   error   exceptions   jvm   java   heap memory   heap


 Q11. When do we generally get this database error - integrity constraint violated - parent key not found ?2016-07-12 08:40:57

Ans. This error most likely will be thrown during an insert statement, while inserting a value within a foreign key column which doesnt exist within the Parent column. For example - Trying to add a dept number reference within a Employee Table when the Dept doesnt exist in the Dept Table.

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

   Like      Discuss      Correct / Improve     database  integrity constraint error  integrity constraint violated


 Q12. When do we generally get the database error - Unique Constraint Violated ?2016-07-12 08:43:38

Ans. This error can result either on an insert, update or delete when any change in data results in duplicate record or subset of it having unique constraint on record or its subset. For example - If we have a unique constraint on a combination of columns and then trying to insert duplicate column values.

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

   Like      Discuss      Correct / Improve     database  Unique Constraint error  Unique Constraint violated


 Q13. Difference between Error and Exception ?Core Java2016-12-15 14:13:56

Ans. An Error indicates serious problems that a reasonable application should not try to catch whereas

An Exception indicates conditions that a reasonable application might want to catch.

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

   Like      Discuss      Correct / Improve     error  exception handling  exceptions     Accenture      basic        frequent


 Q14. 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     ITech      intermediate


 Q15. What is the difference between access and error log ?Logging2017-07-13 13:26:57

Ans. We log each access to the application resource within access logs, something like

"GET / HTTP/1.0" 200 113 "-" "Mozilla/5.0 zgrab/0.x" "-"

We log only error / warn messages within error logs, something like

ERROR 123#0: *19 connect() failed

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

   Like      Discuss      Correct / Improve     logging  access log  error log




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: