The contents of the array a are received by the variable i, the array elements are given by the add method, and the standard output is performed in order by forEach.
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
String[] a = {"Blue", "village", "Wise"};
ArrayList<String> numbersList = new ArrayList<>();
for(String i : a) {
numbersList.add(i);
}
numbersList.stream().forEach((i) -> { System.out.print(i); });
}
}
Recommended Posts