Q:

"Attempt to write to null array" when adding properties to list

i have an adapter that gets a list view , and i wanted to initialize it with lines, 
it used to be written like this > 
 arrayOfSplices = new AligmentListModel[] {
                new AligmentListModel("1", "2", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "12", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "4", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "5", "0", "7", "0", "19"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "4", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "0", "7", "0", "0", "0", "0"),
                new AligmentListModel("0", "1", "2", "3", "0", "15", "99"),
                new AligmentListModel("0", "0", "0", "7", "0", "0", "0"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "13"),
                new AligmentListModel("0", "0", "0", "0", "0", "0", "0"),
                new AligmentListModel("0", "456", "0", "0", "9", "0", "0")};

but now i want to move it to a for loop, 
iv'e tried to do this > 
for (int i = 0; i < 18 ; i++) {
            arrayOfSplices[i] = new AligmentListModel("1", "1", "1", "1", "1", "1", "1");
        }

but i get an error saying > 
java.lang. NullPointerException: Attempt to write to null array

i'm inilizing my list in the create like this > 
AligmentListModel[] arrayOfSplices

how do fix that error ? 

A:

Maybe initialize with
AligmentListModel[] arrayOfSplices = new AligmentListModel[18];

