+ 1
Can someone please help me with my java activities?
6 Answers
0
import java.util.Arrays;
import java.util.Scanner;
public class FilterStringArray {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Please, enter any words separated by space: ");
String userInput = sc.nextLine();
System.out.print("Please, enter minumum word length to filter words: ");
int minLength = sc.nextInt();
String[] words = userInput.split("\\s+");
String[] filteredWords = filterWordsByLength(minLength, words);
System.out.println(Arrays.toString(filteredWords));
}
WRITE CODE BELOW
Method should look like this:
public static String[] filterWordsByLength(int minLength, String[] words) {
<write your code here>
}
0
-The program starts and asks the user to enter random words separated by space
-The program asks users to enter the minimum length of string to filter words which were entered
-The program creates array object from entered words
-The program calls a specific method which takes String[] as a parameter and returns an array of strings which contains words that have length more or equal to the value specified by the user
0
Thank youu for this. Much appreciated.