MysorePak Posted April 25, 2014 Report Posted April 25, 2014 Hi Bhayya nenu if condition lo okka int value !=0 ani compare chesthunanu but adhi null point exce[tion throw chesthunadhi as i am writing in JSP page so direct gaa compare chesthunanu so koncham chepparu how to handle that NPE getabc method is returning int value if(XYS.getabc()!=0)
ZuniorVentiyar Posted April 25, 2014 Report Posted April 25, 2014 XYZ is null , change to if( XYZ != null && XYZ.getbac() != 0) Hi Bhayya nenu if condition lo okka int value !=0 ani compare chesthunanu but adhi null point exce[tion throw chesthunadhi as i am writing in JSP page so direct gaa compare chesthunanu so koncham chepparu how to handle that NPE getabc method is returning int value if(XYS.getabc()!=0)
silent_afdb_follower Posted April 25, 2014 Report Posted April 25, 2014 0 kadu mama null tho check cheyi u shd be good
nok880 Posted April 25, 2014 Report Posted April 25, 2014 Idi try chey work ayyidi If(XYS.getabc() != NULL && CYS.getabc() != "")
cherlapalli_jailer Posted April 25, 2014 Report Posted April 25, 2014 Idi try chey work ayyidi If(XYS.getabc() != NULL && CYS.getabc() != "") this works inka more precise If(XYS.getabc() != NULL && XYS.getabc()!=0)
LungiLingaraju Posted April 25, 2014 Report Posted April 25, 2014 0 kadu mama null tho check cheyi u shd be good XYZ null unatundi anduke NPE throwing so go with checking for null on XYZ first as posted above
LungiLingaraju Posted April 25, 2014 Report Posted April 25, 2014 this works inka more preciseIf(XYS.getabc() != NULL && XYS.getabc()!=0) XYZ ee null unte NPE throw chestadi kada ba
nok880 Posted April 25, 2014 Report Posted April 25, 2014 XYZ ee null unte NPE throw chestadi kada ba Yeah. First e object check cheyyi. If (XYZ != NULL && XYZ != "") Int a = XYZ.getabc(); Paidi try chey.
MysorePak Posted April 25, 2014 Author Report Posted April 25, 2014 ela chesthey i am getting this error The operator != is undefined for the argument type(s) int, null this works inka more precise If(XYS.getabc() != NULL && XYS.getabc()!=0)
MysorePak Posted April 25, 2014 Author Report Posted April 25, 2014 bhayya a method nuchi integer vasthundhi andhuke nenu 0 THO Comparing 0 kadu mama null tho check cheyi u shd be good
porsche911 Posted April 25, 2014 Report Posted April 25, 2014 ela chesthey i am getting this error The operator != is undefined for the argument type(s) int, null if(XYS != null && XYS.getabc() != null && XYS.getabc() != 0) idi try cheyi mayya
LungiLingaraju Posted April 25, 2014 Report Posted April 25, 2014 if(XYS != null && XYS.getabc() != null && XYS.getabc != 0)idi try cheyi mayya +1
nok880 Posted April 25, 2014 Report Posted April 25, 2014 +1 Deniki object null ayite XYZ.getabc() annapudu error vastundi. Idi lekunda rayali
porsche911 Posted April 25, 2014 Report Posted April 25, 2014 Deniki object null ayite XYZ.getabc() annapudu error vastundi. Idi lekunda rayali (XYS != null) condition false ayite compiler doesn't even execute the 2nd condition because of the usage of && statement
Recommended Posts