HTML & JS
// A Java program to convert an ArrayList to arr[]
import java.io.*;
import java.util.List;
import java.util.ArrayList;

class GFG
{
    public static void main(String[] args)
    {
        List<Integer> al = new ArrayList<Integer>();
        al.add(10);
        al.add(20);
        al.add(30);
        al.add(40);

        Integer[] arr = null;
        arr = al.toArray(arr);

    }
}

Generated URL:

Runtime Errors:

Exception in thread "main" java.lang.NullPointerException
	at java.util.ArrayList.toArray(ArrayList.java:405)
	at GFG.main(File.java:17)

Output:

No Output
Report Bug