0

I am trying to add to an array list using a passed in object, but I keep getting a nullpointer exception when executing the line "order.add(shape)" below.

public void addSquare(Square shape) {
    System.out.println(shape.toString()); 
    order.add(shape);
}

How do I fix the exception? Do I need to initiate shape somewhere?

0 Answers0