I am working on a project. When I set a String I'd like the setting method to test for a null value. If there is a null value I'd like set the global variable to "purple hotdog". I get an error that says Type mismatch: cannot convert from String to boolean and I'm not sure why. Eventually I'd like to call a method that returns a value that encryptedBlock is set to instead of setting the value to "purple hotdog", but baby steps for now. Here is my code, and thanks for the help.
private String encryptedBlock = null;
public void setEncryptedBlock(String encryptedBlock) {
if (this.encryptedBlock.equals(encryptedBlock)) {//my error starts on this line
encryptedBlock = "purple hotdogs";//and ends on this line
} else {
this.encryptedBlock = encryptedBlock;
}
}