public Histogram()
{
int[] arrayData = new int[11];
}
You're shadowing your arrayData
field in the constructor. This is creating a local variable with the same name as your class's arrayData
field, initializing it, then immediately discarding it. When you try to use the field later in your code, it's null
. Get rid of the int[]
part.
Note that your next exception will be an ArrayIndexOutOfBoundsException
... you should look at your loop ;)