Q:

Boolean references are null

Can anyone explain why this code results in the below output? 
@Test
public void testBooleanArray() {
    Boolean[] ab = new Boolean[]{a, b};

    a = new Boolean(true);
    b = new Boolean(false);

    for(Boolean x : ab) {
        System.out.println(x);
    }
}

Result: 
null
null

Should the array ab not holds pointers to object a and object b, and therefore output:
true
false

A:

a = new Boolean(true);
b = new Boolean(false);

This does not change the objects that a and b were pointing to(the elements in the array).  It points them to new objects. 
It is not modfying the array
To illustrate:
Boolean a = new Boolean(true);
Boolean b = new Boolean(false);
Boolean c = a;
Boolean d = b;
a = new Boolean(false);
b = new Boolean(true);

c and d will still be true/false respectively.  This is the same thing that is happening with the array, except your array reference isn't named the same way. 

A:

You have to initialize your booleans before assigning them. 
Boolean[] ab = new Boolean[]{a, b};

a = new Boolean(true);
b = new Boolean(false);

to
a = new Boolean(true);
b = new Boolean(false);

Boolean[] ab = new Boolean[]{a, b};

This is before with Objects, you copy the reference to the object, and with new statement, you create a new object, the first a,b were null when assigning. 

A:

Your code unrolled:
Boolean a = null;
Boolean b = null;
Boolean[] ab = new Boolean[2];
ab[0] = a;
ab[1] = b;

a = new Boolean(true); 
b = new Boolean(false); 

The moment the content of the variables named a and b was copied to the array, it was set to null.  There is an important difference to copy by value and copy by reference. 
As a side-note: it is recommended to use Boolean. TRUE instead or at least Boolean.valueOf(true), to avoid unnecessary object creation.  There aren't that many options for a boolean value and Boolean is immutable.