[Bluej-discuss] ex 4.19
John Simonds
simonj2 at sage.edu
Sun Oct 1 17:57:33 BST 2006
I have a problem printing the search term not found. I originally placed it just before the index ++ but that did not get the desired result.
Here is the code I have written..
_/**
* Search method
*/
public void search(String searchString)
{
int index = 0;
boolean found = false;
while(index < notes.size() && !found) {
String note = notes.get(index);
if(note.contains(searchString)) {
found = true;
System.out.println(note);
}
else {
index++;
}
System.out.println("Search term not found.");
}
}
John Simonds
Systems Technologist
simonj2 at sage.edu
(518)244-3111
(518)292-1734
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20061001/bf83475c/attachment.html
More information about the bluej-discuss
mailing list