define array list in android

Solutions on MaxInterview for define array list in android by the best coders in the world

showing results for - "define array list in android"
Federica
20 Apr 2017
1import java.util.ArrayList;
2
3public class ArrayListMethods {
4
5public static void main(String[] args) {
6    
7    //Integer ArrayList
8ArrayList<Integer> aList = new ArrayList<Integer>();
9
10aList.add(5);
11aList.add(11);
12aList.add(17);
13
14System.out.println("Integer Number Added in ArrayList= " + aList);
15
16//String ArrayList
17ArrayList<String> sList = new ArrayList<String>();
18
19sList.add("Learning");
20sList.add("JAVA");
21
22System.out.println("String Added in ArrayList= "+ sList);
23
24
25}
26
27}
28//-----OUTPUT-----
29//Integer Number Added in ArrayList= [5, 11, 17]
30//String Added in ArrayList= [Learning, JAVA]