Question: Java// string is given, using switch case we turn that string into an array, now a method to count the words of the array is
public static void MyMethodClass1(String[] list) \{ Arrays. sort(list); System. out.print(Arrays. toString(list) + " ); public static void wordLength[(String[] list) \{ char [] ch = s.toCharArray(); for(int i=0; i&&ch[i]!=;{ str=str+ch [i]; i++; if(str. length ()>0){ System.out.println(str + "length is "+str. length ()); \}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
