logo Practice-It logo

BJP5 Self-Check 5.17: contains

Language/Type: Java boolean logic return String
Author: Marty Stepp (on 2019/09/19)

The following code attempts to examine a String and return whether it contains a given letter. A flag named found is used. However, the Boolean logic is not implemented correctly, so the method does not always return the correct answer. In what cases does the method report an incorrect answer? Change the code so that it will always return a correct result.

Type your solution here:


You must log in before you can solve this problem.

Log In


Is there a problem? Contact a site administrator.