
I want to create multiple ArrayList .
import java.util.*; class ArrayListNames{ public static void main(String args[]){ //here i want to create 10 arraylists of type string. for(int i=0;i<10;i++){ List<String> ("L"+i)=new ArrayList<String>(); ("L"+i).add("xyz"+i); System.out.println(("L"+i).get(0)); } } }
Here the output i want is .... xyz0 xyz1 xyz2 xyz3 xyz4 xyz5 xyz6 xyz7 xyz8 xyz9
But i am getting an error.Can you help me in this case.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.