← Unit 1 · all exercises
Saved in this browser only

Is it in there

Return true when the sentence contains the given word anywhere inside it, and false otherwise. Capital letters matter.

boolean has(String sentence, String word)

Solution.java
Loading editor…
Results

Examples

  • has(hello world, world) → true
  • has(hello world, java) → false

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