こんにちは、ネストされた for ループを使用して、2 つの文字列配列間の一致を見つけようとしています。ただし、それ以上の回数ループしたようです。
for(int i = 0; i < ca; i++) //ca contains 10
{
for(int j = 0; j < ra; j++) //ra contains 10
{
if(cAnswers[i].equals(rAnswers[j]))
{
count++; //Increments count to indicate a match
System.out.println("The current count: " + count); //To check the count
}
}
}
System.out.println("The number of correct questions is " + count + "/10"); //The result currently gives me 50/10 no matter what.
< の代わりに <= を使用しようとしましたが、最終的にインデックスが範囲外になりました。