Im trying to make a program that simulates a vending machine while using stacks and queues, but while sending out the method to add the objects into my linked list I keep getting a null pointer exception. heres the code with MachineRow being an interface and FIFO being a linkedList
public static void loadFIFO(int size, Scanner keyboard, MachineRow FIFO)
throws FileNotFoundException {
System.out.print("Enter filename: ");
String fileopen = keyboard.nextLine();
Scanner inputFile = new Scanner(new File(fileopen));
int j = 0;
while (inputFile.hasNext() && j < size) {
String name = inputFile.nextLine();
String type = inputFile.nextLine();
String upc = inputFile.nextLine();
VendingProduct add = new Product(name, type, upc);
if(FIFO.add(add)==true){
j++;
}
}
}

and heres the method in the FIFORow class

public boolean add(VendingProduct product) {
FIFOrow.addFirst(product);
boolean added=true;
return added;
}

please help if you can!