So it seems this method is going into an infinite loop if the if(printLibraryNumber.equals(borrowersArray[index].getLibraryNumber() statement is true, and I have no idea why.
public boolean printBorrower(String printLibraryNumber)
{
int index = 0;
boolean isPrinted = false;
while(index < currentIndex)
{
if(printLibraryNumber.equals(borrowersArray[index].getLibraryNumber()))
{
borrowersArray[index].printBorrowerDetails();
isPrinted = true;
}
else
{
index++;
isPrinted = false;
}
}
if(isPrinted == false)
{
System.out.println("Borrower with library number " + printLibraryNumber + " not found.");
}
return isPrinted;
}
Aucun commentaire:
Enregistrer un commentaire