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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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
how can u handle run time exception in java? explain with 
brief explanation with examples?
 Question Submitted By :: Jawahar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how can u handle run time exception in java? explain with brief explanation with examples?
Answer
# 1
public class ExceptionalClass {
public void method1() throws CheckedException {
        // ... some code
        throw new CheckedException( "something bad 
happened" );
}
    public void method2( String arg ) {
        if( arg == null ) {
            throw new NullPointerException( "arg passed to 
method2 is null" );
}   
}
public void method3() throws CheckedException {
    method1();
}
}  

            Contrast method1() with method2(). When you 
make a call to method2(), you don't have to do so within a 
try/catch block. Since you do not have to catch the 
exception, the exception is said to be unchecked; it is a 
runtime exception. A method that throws a runtime exception 
need not declare the exception in its signature.
 
Is This Answer Correct ?    1 Yes 0 No
Pavithra
 
  Re: how can u handle run time exception in java? explain with brief explanation with examples?
Answer
# 2
Runtime exceptions represent problems that are detected by 
the runtime system. This includes arithmetic exceptions 
(such as when dividing by zero), pointer exceptions (such 
as trying to access an object through a null reference), 
and indexing exceptions (such as attempting to access an 
array element through an index that is too large or too 
small). 

Runtime exceptions can occur anywhere in a program and in a 
typical program can be very numerous. Typically, the cost 
of checking for runtime exceptions exceeds the benefit of 
catching or specifying them. Thus the compiler does not 
require that you catch or specify runtime exceptions, 
although you can.
 
Is This Answer Correct ?    1 Yes 0 No
Pavithra
 
 
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
can u override the start() method of Thread class  4
Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.  1
What is an Applet ?  2
What is the difference between Resultset and Rowset. IBM2
Why const and goto are reserved keyword in java?  1
what is business delegate? TCS2
What is exception and error? and what is the difference between them?  2
String is a immutable objects . it means that string does not change........... But it will be chang......... { String s="kapil"; String s1="raj"; String s=s1; then print(.......) The String has been changed .. how it is possible and why its called immutable objects  2
How can you take string into InputStream?  3
How to access a method that it declared as protected?  3
What is stop(), suspend(), resume() method?  3
what is the use of servlet engine? Photon2
is memory to the abstract class allocated ..or objects not instantiated TCS4
What is a deadlock ?  4
How many times garbage collector will invoke an object?s finalize() method?  4
How can you reverse a string?  2
Can we access private data outside of the class directly in java programming language? Why There is no runtime checking in java, which leads to access the private data directly outside of a class? Google1
What is Exception handling in Java How do you handle run time errors please explain with an example TCS1
What is thin driver and thick driver. why it is called so? Logisoft1
How the elements are organized in BorderLayout?  4
 
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