Question: Re-write Problem 2 to use a method that will produce the same output as Problem2. The program has a method called commonLetters. This method takes

Re-write Problem 2 to use a method that will produce the same output as Problem2. The program has a method called commonLetters. This method takes in two words (both are Strings) and returns a new String that contains the letters that both Strings contain in lower case (no duplicates). Hint: look at the String method indexOf(char). The method header is: public static String commonLetters (String str1, String str2) You will test your method in the main method of your program by using a Scanner object that will read in two Strings. Then call the method and pass the two Strings into the method and print the new String. Sample Input (2 Strings) Halifax Dartmouth Sample Output alhi Truro Toronto tro Happy dancing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
