不识别数组java中的元素

时间:2017-06-01 06:13:32

标签: java

我一直在研究这个小问题几个小时,似乎无法找到问题,当我将用户输入的单词与数组列表中的单词进行比较时,它并没有识别单词。这是代码:

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);
    }

每次都会说错误鸟没找到 亲切的问候 约旦

0 个答案:

没有答案