Nov 16, 2015 04:59 PM
(This post was last modified: Nov 16, 2015 04:59 PM by Paathurnax.)
Using the code below, I need to test whether or not the method has been successful in working, and then print "false" if the method has not been successful.
I was thinking about using a boolean 'found' which I can set to be true if the method worked properly, and then if it's still false then to print "false".
However, I'm not sure how to implement this. I'm assuming you need to use loops, but I'm not sure how to do it.
Anyone got an idea?
Code
private void doShowBorrower()
{
boolean found = false;
System.out.println("Enter Library Number to Search: ");
String borrowerLibraryNumber = myScanner.next();
borrowerList.getBorrower(borrowerLibraryNumber);
}I was thinking about using a boolean 'found' which I can set to be true if the method worked properly, and then if it's still false then to print "false".
However, I'm not sure how to implement this. I'm assuming you need to use loops, but I'm not sure how to do it.
Anyone got an idea?
![[Image: abTrs9B.png]](https://i.imgur.com/abTrs9B.png)
16pVw8g1csPoa7BFJ6bTADa12yteiAvcst




![[Image: 0DvFxnA.gif]](https://i.imgur.com/0DvFxnA.gif)
![[Image: hfnmhEI.jpg]](https://i.imgur.com/hfnmhEI.jpg)