Why is my constructor not initiliazing a variable correctly? : So I am trying to read in a file and create an arralist of those objects. The number of objects within the file is what I want my numItems variable to be set to, but I am getting an error. 
  

    public class Warehouse
    {
    // instance variables (fields)  
    private final static int MAX = 60;
    private ArrayList <Item> stock;
    private int numItems;

    // the constructor
    public Warehouse()
    {
        stock = new ArrayList<Item>();
        numItems = loadData();
    }

    
    public int loadData(File infile) throws IOException
    {
        Scanner in = new Scanner (infile);
        int number = 0;
        
        while(in.hasNext())
        {
            String item = in.nextLine();
            String [] items = item.split(" ");
            String itemNum = items[0];
            String itemName = items[1];
            int onHand = Integer.parseInt(items[2]);
            int committed = Integer.parseInt(items[3]);
            int onOrder = Integer.parseInt(items[4]);
            double price = Double.parseDouble(items[5]);
            int reOrderPt = Integer.parseInt(items[6]);
            int econOrder = Integer.parseInt(items[7]);
            stock.add(number, new Item(itemNum, itemName, onHand, committed, onOrder, price, reOrderPt, econOrder));
            number++;
        }
        
        return number;
    }