我正在比较两个完成的字符串数组,我想在下面的代码中得到正确和不正确的数组。帮助表示赞赏。
                 boolean foundtext = false;
            //outer loop for all the elements in arrayA[i]
            for(int j = 0; j < array1.length; j++)
            {
                //System.out.println("ArrData" + (array1[j]));
            //inner loop for all the elements in arrayB[j]
            for (int k = 0; k < compare1.length;k++)
            {   //System.out.println("FieData" + (i1[k])); 
            //compare arrayA to arrayB and output results
            if( array1[j].equals(compare1[k]))
            {
            foundtext = true;
                //return j;
            System.out.println( "arrayA element \"" + array1[j] + "\" was found in arrayB" );
            //System.out.println("Correct" + correctCount);
            } 
            }
            if (foundtext == false)
            {
            System.out.println( "arrayA element \"" + array1[j] + "\" was Not found in arrayB" );
            //System.out.println("InCorrect" + incorrectCount);
            }
            //set foundtext bool back to false
            foundtext = false;
            }