string array list android code example
Example 1: android arraylist
import java.util.ArrayList;
ArrayList<Integer> aList = new ArrayList<Integer>();
aList.add(5);
aList.add(11);
aList.add(17);
System.out.println("Integer Number Added in ArrayList= " + aList);
ArrayList<String> sList = new ArrayList<String>();
sList.add("Learning");
sList.add("JAVA");
System.out.println("String Added in ArrayList= "+ sList);
Example 2: define array list in android
import java.util.ArrayList;
public class ArrayListMethods {
public static void main(String[] args) {
ArrayList<Integer> aList = new ArrayList<Integer>();
aList.add(5);
aList.add(11);
aList.add(17);
System.out.println("Integer Number Added in ArrayList= " + aList);
ArrayList<String> sList = new ArrayList<String>();
sList.add("Learning");
sList.add("JAVA");
System.out.println("String Added in ArrayList= "+ sList);
}
}