Instead of:
Scanner stocksBought1 = new Scanner("stocksbought/stocksBought1.txt");
Try:
Scanner stocksBought1 = new Scanner(new File("stocksbought/stocksBought1.txt"));
When you only pass a String
to the Scanner
constructor the Scanner
just scans that String
. If you give it a File
it will scan the contents of the File
.