0

I have been working on this small problem for hours and cant seem to find problem, bassically it is not recognising a word when i compare user entered word to a word in the array list. Here is code:

birdToRemove = JOptionPane.showInputDialog("Type bird to remove, or cancel 
to continue");
    while(increment <= amountBirds)
    {

        if(birdToRemove == birdArray[increment])
        {
            found = true;
            birdArray[increment] = null;

            JOptionPane.showMessageDialog(null, "Deleted");
            deleteEntry();
        }
        if(birdArray[increment] != birdToRemove)
        {
            increment = increment + 1;
        }
    }

    if(found == false)
    {
        JOptionPane.showMessageDialog(null, "Error, bird not found", "Error", JOptionPane.ERROR_MESSAGE);
    }

Everytime it will say Error bird not found Kind regards Jordan

JC101
  • 1
  • change your condition to `if(birdToRemove.equals(birdArray[increment])`. Your second condition, `if(birdArray[increment] != birdToRemove)` should also just change into `else`. – ernest_k Jun 01 '17 at 06:16
  • Ah nice, you boss :D. Thanks! – JC101 Jun 01 '17 at 06:20

0 Answers0