Question: Write the method containsT(String [] words). This method should return true in the case that a word in the array contains the letter t. The
- Write the method containsT(String [] words). This method should return true in the case that a word in the array contains the letter "t". The method should return false in the case that none of the words contain the letter "t". Consider using the method indexOf from the Java Quick reference sheet :)
You may assume that words is not null (that it has at least one value in it).
Ex) String [] wds = {"bird", "dog", "cat"};
System.out.println(containsT(wds));//prints true
String [] wds2 = {"bird", "dog", "car", "cookie", "spinach"};
System.out.println(containsT(wds2));//prints false
public static boolean containsT(String [] words)
{
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
