Answers for "set boolean to null java"

0

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;
		}
	}
}
Posted by: Guest on December-03-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language