how to convert array to arraylist in java

Valentsea
Total
0
Shares

for explanation watch the video


import java.util.*;
import java.lang.*;
class Demo{
    public static void main(String[] args){
        Integer[] arr = {1,2,3,4,5};
        //List al = new ArrayList<>(Arrays.asList(3,4,5,6));
        //al.add(45);
        List al = new ArrayList<>(Arrays.asList(arr));
        System.out.println(al);
    }   
}

Enter fullscreen mode

Exit fullscreen mode

Total
0
Shares
Valentsea

What Kind of Music or Podcasts Do You Listen to While You Code?

Do you like to listen to music or podcasts while you code? If so, what kind of music…

You May Also Like