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

  1. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!