← Unit 4 · all exercises
Saved in this browser only

Join the words

Return every word in the list joined with a comma and a space between them. An empty list gives an empty String, and there must be no separator on the end.

String join(java.util.ArrayList<String> words)

Solution.java
Loading editor…
Results

Examples

  • Solution.join(new java.util.ArrayList<>(java.util.List.of("a", "b", "c"))) → a, b, c
  • Solution.join(new java.util.ArrayList<>(java.util.List.of("solo"))) → solo

There are also 2 hidden tests you can't see. Solve the problem, not the examples.