- Use carefully Boolean in setter method for boolean attribute:
DON'T DO THIS (throws null pointer exception):
public
class BooleanMethod {
*
@return the attribute
*/
}
*
@param attribute the attribute to set
*/
}
BooleanMethod obj =
new BooleanMethod();
Boolean condition =
null;
obj.setAttribute(condition);
System.
out.println(obj.isAttribute());
}
Exception in thread "main"
java.lang.NullPointerExceptionat BooleanMethod.main(BooleanMethod.java:23)BETTER
public
class BooleanMethod {
*
@return the attribute
*/
}
*
@param attribute the attribute to set
*/
}
BooleanMethod obj =
new BooleanMethod();
Boolean condition =
null;
obj.setAttribute(condition);
}
System.
out.println(obj.isAttribute());
condition = Boolean.
TRUE;
obj.setAttribute(condition);
}
System.
out.println(obj.isAttribute());
}
The casino was raided by an agent on July 18
RispondiEliminaA man with a 넷마블 바카라 gambling license in Oklahoma has been melbet arrested on charges that 토토 사이트 직원 모집 the gambler stole $3 million 토토 꽁머니 of cash and other merchandise. 알바로 모라타