import java.util.ArrayList;
import java.util.List;
public class List_for_int {
public static void main(String[] args) {
List list=new ArrayList();
int arr1[]={11,12,13,14,15};
for (int i = 0; i < arr1.length; i++) {
list.add(arr1[i]);
}
for (int i = 0; i < arr1.length; i++) {
System.out.println((i+1)+" : "+list.get(i));
}
}
}
Output
1 : 11
2 : 12
3 : 13
4 : 14
5 : 15
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.