First off, I\'m new to java and trying to complete an assignment from school on creating a vending machine. My program is taking in 2 files as cli arguments, one for products, a
By adding the semicolon (;), you are implicitly having the while loop execute an empty block. hasNextLine() doesn't doesn't change the InputStream the scanner is based on, so since there's nothing in the while loop's body, there's nothing to change the state, and the loop will just continue forever.
Just drop the semicolon from the while loop, and you should be fine:
while (moneyTemp.hasNextLine()) // no ; here!
{
numMoney++;
moneyTemp.nextLine();
}