Answers for "array arraylist java in android"

0

android arraylist

import java.util.ArrayList;

    //Integer 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);

//String ArrayList
ArrayList<String> sList = new ArrayList<String>();

sList.add("Learning");
sList.add("JAVA");

System.out.println("String Added in ArrayList= "+ sList);
Posted by: Guest on March-15-2020
0

define array list in android

import java.util.ArrayList;

public class ArrayListMethods {

public static void main(String[] args) {
    
    //Integer 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);

//String ArrayList
ArrayList<String> sList = new ArrayList<String>();

sList.add("Learning");
sList.add("JAVA");

System.out.println("String Added in ArrayList= "+ sList);


}

}
//-----OUTPUT-----
//Integer Number Added in ArrayList= [5, 11, 17]
//String Added in ArrayList= [Learning, JAVA]
Posted by: Guest on November-27-2020

Code answers related to "array arraylist java in android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language