Question: 14 The method below generates all substrings of a String passed as argument. Assuming that the string contains no duplicate characters, select the statement to
14 The method below generates all substrings of a String passed as argument. Assuming that the string contains no duplicate characters, select the statement to complete the method so that it prints all substrings correctly. public static void printSubstrings (String word) { } if (word.length() > 0) ( } for (int j = 1; j <- word.length(); j++) // print substrings that begin with the first character { 4 } System.out.println (word.substring(0, 1)); // print substrings without the first character O printSubstrings (word.substring(0)); OprintSubstrings (word.substring(1)); O printSubstrings (word.substring(word.length())); O printSubstrings (word.substring(word.length() - 1)); 6 pts
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
