My problem is that it always goes to nothing to load - file is empty!
public void Loader(LinkList AccountList) throws IOException
{
//File AccountsFile = new File("Accounts");
//Scanner keyboard = new Scanner(AccountsFile);
//if (AccountsFile.exists())
//{
try
{
File AccountsFile = new File("Accounts");
Scanner keyboard = new Scanner(AccountsFile);
while(keyboard.hasNextLine())
{
//make account list empty
AccountList.head = null;
Account p = new Account();
String AccountNumberLoaded = keyboard.nextLine();
int AccountInt = Integer.parseInt(AccountNumberLoaded);
p.setAccountNumber(AccountInt);
p.setName(keyboard.nextLine());
p.setAddress(keyboard.nextLine());
String BalanceLoaded = keyboard.nextLine();
double BalanceDouble = Double.parseDouble(BalanceLoaded);
p.setBalance(BalanceDouble);
AccountList.add(p);
}
if(!(keyboard.hasNextLine()))
{
System.out.println("Nothing to load - File is Empty!");
}
}
//if (!(AccountsFile.exists()))
catch (Exception e)
{
System.out.println("No File Exists!");
}
MainClass.Menu(AccountList);
} }