Convert Array to ArrayList

 

How to Convert Array to ArrayList In java:

We can make a arraylist from array using asList() method of array in java.

import java.util.ArrayList;
import java.util.Arrays;

public class ArrayToArrayList {

public static void main(String[] args) {

String [] brr ={“HTML”,”PHP”,”JAVA”,”C”};

ArrayList<String> arr= new ArrayList<String>(Arrays.asList(brr));

System.out.println(“ArrayList Is =”+arr);

}

}

Output:

ArrayList Is =[HTML, PHP, JAVA, C]

Related Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *

7 + 3 =