estoy tratando de verificar si un objeto es nulo o no y estoy usando esta sintaxis:¡compara un objeto con nulo!
void renderSearch(Customer c){
System.out.println("search customer rendering>...");
try {
if(!c.equals(null)){
System.out.println("search customer found...");
}else{
System.out.println("search customer not found...");
}
} catch (Exception e) {
System.err.println ("search customer rendering error: "
+ e.getMessage()+"-"+e.getClass());
}
}
consigo la siguiente excepción:
search customer rendering error: null class java.lang.NullPointerException
pensé que estaba teniendo en cuenta esta posibilidad con mi ciclo if if else. Cualquier ayuda sería apreciada.
ventaja. if y else no se llama bucle. es una condición – Midhat