ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
what is difference between Exception and Error?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is difference between Exception and Error?
Answer
# 1
Exceptions are those which can be handled at the run time
where as errors cannot be handled.
Examples for exceptions: Array out of bonds, attempt to
divide by zero etc.
Exceptions can be handled by handlers using try - catch.
 
Is This Answer Correct ?    21 Yes 5 No
Shivaprasad
 
  Re: what is difference between Exception and Error?
Answer
# 2
The functional diiference, in terms of the compiler, is 
that you don't have to declare errors in throws clauses on 
methods, or catch them.

Conceptually, an Error means something has gone wrong with 
your program, which should usually give up and crash, 
whereas an exception is for an unusual situation that you, 
as a programmer, anticipated as a possibilty. So, for 
example, a divide-by-zero is an Error, but attempting to 
read a file and finding it doesn't exist is an Exception.
 
Is This Answer Correct ?    15 Yes 9 No
Sandeep Tyagi
 
 
 
  Re: what is difference between Exception and Error?
Answer
# 3
Exception means When a method encounters an abnormal 
condition (an exception condition) that it can't handle 
itself, it may throw an exception. 
Error mens system doesn't handle.For example:Overflow,Out 
of memory.
 
Is This Answer Correct ?    6 Yes 6 No
Ganesh
 
  Re: what is difference between Exception and Error?
Answer
# 4
Error : Something goes wrong in our application/program , 
that leads to crash your output/logic is called as error. 
the error may be of syntatic error or error which can 
easily identify the programmer.

Exception : during the execution(runtime) of our 
application/program, the system leads to something wrong 
statements like 'system out of memory' 'out of arguments' 
called Exception.

Exceptions can easily handle by lot of exception handler in 
c# classes(Framework class libraries). Normally C# have 20 
different types of exception handler. they are
Exception Class  Cause  
SystemException  A failed run-time check;used as a base 
class for other.  
AccessException  Failure to access a type member, such as a 
method or field.  
ArgumentException  An argument to a method was invalid.  
ArgumentNullException  A null argument was passed to a 
method that doesn't accept it. 
ArgumentOutOfRangeException  Argument value is out of 
range.  
ArithmeticException  Arithmetic over - or underflow has 
occurred.  
ArrayTypeMismatchException  Attempt to store the wrong type 
of object in an array.  
BadImageFormatException  Image is in the wrong format.  
CoreException  Base class for exceptions thrown by the 
runtime. 
DivideByZeroException  An attempt was made to divide by 
zero.  
FormatException  The format of an argument is wrong.  
IndexOutOfRangeException  An array index is out of bounds.  
InvalidCastExpression  An attempt was made to cast to an 
invalid class.  
InvalidOperationException  A method was called at an 
invalid time.  
MissingMemberException  An invalid version of a DLL was 
accessed.  
NotFiniteNumberException  A number is not valid.  
NotSupportedException  Indicates sthat a method is not 
implemented by a class.  
NullReferenceException  Attempt to use an unassigned 
reference.  
OutOfMemoryException  Not enough memory to continue 
execution. 
StackOverflowException  A stack has overflown.
 
Is This Answer Correct ?    4 Yes 5 No
Boopathy
 
  Re: what is difference between Exception and Error?
Answer
# 5
Exception is an abnormal condition occured at runtime.
Error is the one which is of runtime exception type,theat
what we cann't declare in throws clause.
 
Is This Answer Correct ?    5 Yes 6 No
Ravikiran
 
  Re: what is difference between Exception and Error?
Answer
# 6
Exceptions can be system defined or CAN BE USER DEFINED
(means user can enforce exceptins) whereas run time errors 
are thrown by system only.
 
Is This Answer Correct ?    2 Yes 6 No
Vinay
 
  Re: what is difference between Exception and Error?
Answer
# 7
Exception is coverable 
Error is uncoverable 

Exception can be handled 
and Error can not be handled

Exceptio is an run time error when an abnormal condition is
occured the jvm detect it and make the object of that
abnormal condition and throws it to its own class and that
object is catched by catched block and catch block handled it

Error is the compile time error not runtime and it is not
covered it is only fixed by a programer.

Note 
When Error occur then our programe stops and donot run 

but If exception occur then nothing happining only try block
will be suspended and after that if any code is written that
will be executed properly means our system or programe work
properly.
 
Is This Answer Correct ?    8 Yes 2 No
Shahnawaz Ali Shah
 
  Re: what is difference between Exception and Error?
Answer
# 8
Error: Any departure from the expected behavior of the 
system or program, which stops the working of the system is 
an error. Exception:Any error or problem which one can 
handle and continue to work normally. 
An Exception can be caught and recovered: 
ArrayIndexOutOfBoundsException means you tried to access a 
position of an Array that does not exist - no big deal. 
An Error is unrecoverable: OutOfMemoryError means that 
the JVM has no more memory to store.
Java a compile time error is normally called an "error," 
while a runtime erroException can be handled and Error can 
not be handled 
When Error occur then our program stops and don't run but 
If exception occur then nothing happening only try block 
will be suspended and after that if any code is written 
that will be executed properly means our system or program 
work properly.
r is called an "exception."
 
Is This Answer Correct ?    5 Yes 3 No
Doshi Rinal 9998099633
 
  Re: what is difference between Exception and Error?
Answer
# 9
Error : Something goes wrong in our application/program , 
that leads to crash your output/logic is called as error. 
the error may be of syntatic error or error which can 
easily identify the programmer.

Exception:its unwanted and unexpeceted event its disturb the
normal flow of program execution.
          Exception is an object it occurs at run time it
gives system error message and then convert system error
message into user friendly messages
 
Is This Answer Correct ?    0 Yes 3 No
Paletipatisrinu
 
  Re: what is difference between Exception and Error?
Answer
# 10
Exception means abnormal condition which is occur in our
code during program execution.
but error means it can't handle by the system.for
example,thread dead,out of memory,overflow.
 
Is This Answer Correct ?    0 Yes 2 No
Milan Kumar
 
  Re: what is difference between Exception and Error?
Answer
# 11
exception occurs at runtime of your program
while an error may arise during your compile time
 
Is This Answer Correct ?    1 Yes 1 No
Zohaib
 
  Re: what is difference between Exception and Error?
Answer
# 12
Errors are the abnormal conditions which can not be handled
by your program and the program will immediately interrupt
while exceptions are those abnormal conditions which your
program can handle with the techniques of error handling.
Errors can not be handled and will stop uour program.
 
Is This Answer Correct ?    2 Yes 0 No
Saurabh Kumar Gupta
 
  Re: what is difference between Exception and Error?
Answer
# 13
Errors are the abnormal conditions which can not be handled
by your program and the program will immediately interrupt
while exceptions are those abnormal conditions which your
program can handle with the techniques of error handling.
Errors can not be handled and will stop uour program...
 
Is This Answer Correct ?    0 Yes 0 No
Ved
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Life Cycle of Thread IBM3
What is object  6
what is difference between requestprocessor and request dispatcher? Tech-Mahindra1
How to make a class immutable? Bosch6
How are this and super used?  6
What are access modifiers in Java ?  5
Catch(Exception e){ } in that what is Exception and purpose of that in that place exactly?  3
What are concepts of OOPS and how are they implemented in Java? KPIT2
What enableEvents() method do?  1
what is the difference between a java object reference and c++ pointer?  3
can we Connect Applet to Data Base ? with Discriptiom. and also What is Diff. from Applet & Servlet? Systematix1
What is Map interface? Wipro2
What is the format of Inner Class after it compiled?  1
Why can't we make jsp as a controller and action servlet in struts? TCS6
can we create instance for interface in java?  2
What is Hash Code in Java? Cognizent1
What is the is a and has a relation ship in oops concept in java? BearingPoint5
class A { class B { psvm(String args[]) { } } } if the prg saved in A.java whats the o/p? HCL5
what is the difference between HashMap and Hashtable Value-Labs8
What is CardLayout? Infosys1
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com