Popular Posts

Tuesday, January 25, 2011

Top 10 Exceptions In Real Time

There are 10 Exceptions that come freequently in real time usuage.
1.NullPointerEexception.
        -If we are trying to access a members(data variables or methods) of a class by using an object of the class,which has null reference.
Eg: public class NPETest{
    public static void main(String[] args){
        NPETest reference = null;
        reference.display();  
       // this statement will throw NullPointerException.
        
}
public static void display(){
   // some code goes here...  
}
}
2.ClassCastException.
3.NumberFormateException.
4.ArrayIndexOutOfBoundsException

No comments:

Post a Comment