KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > lang > NullPointerException

java.lang
Class NullPointerException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by java.lang.NullPointerException
All Implemented Interfaces:
Serializable
See Also:
Top Examples, Source Code

public NullPointerException()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[25]NullPointerException when converting float
By Max Okist on 2004/02/08 16:57:48  Rate
Float f; 
 try  {  
    f =  (  ( Integer ) parameters.get ( "float" )  ) .floatValue (  ) ; 
  }  catch  ( NullPointerException npe )   {  
    f = 0; 
  } 


[657]_
By patel_amit78 { at } homtail { dot } com on 2005/03/07 13:31:54  Rate
Float f,e;  
 try  {   
    f =  (  ( Integer ) parameters.get ( "float" )  ) .floatValue (  ) ; 
    e =  (  ( Integer ) parameters.get ( "float" )  ) .floatValue (  ) ;  
  }  catch  ( NullPointerException npe )   {   
    f = 0;  
  }  
 


[1853]Minimizing the risk of null pointer exceptions
By Anonymous on 2006/12/14 17:05:40  Rate
for minimizing the risk of null pointer exceptions, use: 
  
  
  "xyz".equals (  str )  
  
  
  instead of 
  
  
  str.equals ( " xyz" ) 


[2005]nullpointerexception
By nathanielZky { at } yahoo { dot } com on 2010/01/12 07:38:24  Rate
public class NullPointerTest   {    
  String nullVar;  
  NullPointerTest  (    )     {    
  try   {    
   if  (  nullVar.equals  (  "Null"  )    )     {    
         System.out.println  (  "This wont print"  )  ;  
     }    
    }   catch  (  NullPointerException e  )     {    
        System.out.println  (  "This may print"  )  ;  
     }    
    }    
  
  
 Read more: http://kickjava.com/1249.htm#ixzz0cPQCwc2F 
 


public NullPointerException(String s)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1774]NullPointerException
By ponmalar on 2006/06/12 02:58:28  Rate
public class NullPointerTest  {  
 String nullVar; 
 NullPointerTest (  )   {  
 try  {  
  if ( nullVar.equals ( "Null" )  )   {  
        System.out.println ( "This wont print" ) ; 
   }  
  }  catch ( NullPointerException e )   {  
       System.out.println ( "This may print" ) ; 
   }  
  }  
 

Popular Tags