← Unit 2 · all exercises
Saved in this browser only

Yes or no

Return true when the answer is the word yes or the word no, in any mix of capitals. Anything else is false.

boolean isYesOrNo(String answer)

Solution.java
Loading editor…
Results

Examples

  • isYesOrNo(yes) → true
  • isYesOrNo(maybe) → false

There are also 4 hidden tests you can't see. Solve the problem, not the examples.