let’s suppose that the startDate is null
if(element.getStartDate()!=null & element.getStartDate().length()>0){
//Treatment1 is not executed a nullPointerException is fired
}
& ,tests both left and right operand even if the left is false
in this example if we use the && » wich controle the right and the left operand » we can get a null startDate but
when it asses to test the second part we got element.null.length so a nullPointerExeption is fired
&& , if the left operand is false we don’t test the right one
if(element.getStartDate()!=null & element.getStartDate().length()>0){
//Treatment2 is xecuted
}
$$ || are also named short-circuitting operator
See you folks :))