Write a method markLength4 that takes an ArrayList of Strings as a parameter and that places a String of four asterisks ("****") in front of every String of length 4. For example, suppose that an ArrayList called "list" contains the following values: (this, is, lots, of, fun, for, every, Java, programmer) And you make the following call: markLength4(list); Then list should store the following values after the call: (****, this, is, ****, lots, of, fun, for, every, ****, Java, programmer) Notice that you leave the original Strings in the list (this, lots, Java) but include the four-asterisk String in front of each to mark it. You may assume that the ArrayList contains only String values, but it might be empty.
Write a method markLength4 that takes an ArrayList of Strings as a parameter and that places a String of four asterisks ("****") in front of every String of length 4. For example, suppose that an ArrayList called "list" contains the following values:
(this, is, lots, of, fun, for, every, Java, programmer)
And you make the following call:
markLength4(list);
Then list should store the following values after the call:
(****, this, is, ****, lots, of, fun, for, every, ****, Java, programmer)
Notice that you leave the original Strings in the list (this, lots, Java) but include the four-asterisk String in front of each to mark it. You may assume that the ArrayList contains only String values, but it might be empty.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images