Java, as almost all programming languages, does have if and if/else statements avaiable. I'm fairly sure they would be covered in your text (at some point). You can also thake a look at the Sun's online tutorial on Control Flow Statements.
At a quick glance, using if statements is the way I would go about solving that problem. However I am curious as to why it would be presented to you prior to learning about if statements. What topics have you covered so far?