No, the answer variable will have a value anywhere in the method. It will default to zero and then can be changed anywhere by an assignment statement.outside the if statements, it has no value.
Add printlns to show its value before and after all the if statements where it has a value assigned to it.