You can test here: https://www.compilejava.net/
import java.util.ArrayList;
import java.util.Arrays;
public class HelloWorld
{
public static void main(String[] args)
{
ArrayList<String> str = new ArrayList<>(Arrays.asList("test1", "test2", "test3", "test4"));
System.out.print(str.get(0) + ", " + str.get(1) + ", " + str.get(2) + ", " + str.get(3));
}
}
import java.util.Arrays;
public class HelloWorld
{
public static void main(String[] args)
{
ArrayList<String> str = new ArrayList<>(Arrays.asList("test1", "test2", "test3", "test4"));
System.out.print(str.get(0) + ", " + str.get(1) + ", " + str.get(2) + ", " + str.get(3));
}
}