How to declare an ArrayList with values? [duplicate]

This question already has answers here: Initialization of an ArrayList in one line (33 answers) Closed 6 years ago. ArrayList or List declaration in Java has questioned and answered how to declare an empty ArrayList but how do I declare an ArrayList with values? I’ve tried the following but it returns a syntax error: import … Read more