java - Null pointer access: The variable "tipoEstablecimiento" can only be null at this location -
i've been searching in internet error no result. i'm lost it. can it?
. . . tipoestablecimientohotel tipoestablecimiento = null; . . . . try{ tipoestablecimiento.setcodigo(""); <--- line error. }catch (exception e){ system.out.println(e.getmessage()); } . . .
of course have imports need (i mean tipoestablecimiento), , marks line corresponding warning.
thanks in advance.
you didn't show enough code, i'd go error got. don't initialize variable between assigning null , calling setcodigo
method you'll surely nullpointerexception (you cannot dereference null object). make sure instantiate before using calling constructor, like:
tipoestablecimiento = new tipoestablecimientohotel();
Comments
Post a Comment