java cast null to boolean code example
Example: java stop convert null to boolean false
public class Produto{
private Boolean promocao;
public Boolean isPromocao() {
if (promocao instanceof Boolean) {
return promocao;
} else {
return null;
}
}
public void setPromocao(Boolean promocao) {
if (promocao instanceof Boolean) {
this.promocao = promocao;
} else {
return;
}
}
}