*** EDIT ***
I found my problem. The method was being called inside of a while loop in the main method that had a boolean value that was never being changed. Mods, please delete this thread.
I have written a search method to search thru a stack. The idea is for it to recursively call itself if the user enters any key but 'n'. If the user enters 'n', I want the method to end and to return to main.
Right now, my problem is that this method seems to be infinitely calling itself instead of exiting once 'n' is entered. Can you help me find my error?
public static void SearchStack(Stack s1, Stack s2, int key)
Scanner keyboard = new Scanner(System.in);
boolean found = false;
int compare = (Integer)s1.pop();
if(compare == key)
System.out.println(key + " was found.");
found = true;
System.out.println(key + " was not found.");
System.out.println("Would you like to search for another value? Enter N if you do not.");
System.out.println("Enter a value to search the stack for: ");
int find = keyboard. nextInt();
SearchStack(s2, s1, find);