
hi... if add element to list we have to add like using string format only for example list.add("1");
is it right or wrong i.e list.add(1);

Array list can store almost every value either it is string , integer, double etc.
import java.util.*;
class ArrayListExample{
public static void main(String[] args){
ArrayList list=new ArrayList();
for(int i=1;i<=10;i++){
list.add(i);
}
for(int i=0;i<list.size();i++){
System.out.println(list.get(i));
}
}
}
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.