この基本的なプログラムについて助けが必要です。私の友人は、このコードのほとんどを教えてくれましたが、インポート ステートメントは教えてくれませんでした。それが言うところの終わりに向かってlist.add(finalCombined.get(counter3));
、それは私にエラーを与えます。私が得るエラーは
Cannot find Symbol
Symbol: variable list
location: class ArrayUtils
私はこれに非常に混乱しています。必要と思われる import ステートメントを追加しました。ありがとうございました
import java.util.ArrayList;
import java.util.Random;
import java.util.Collections;
import java.lang.String;
public class ArrayUtils {
public void randomStrings(ArrayList<String> arrayList,int nbrOfStrings,int vowelCnt, int strSize){
ArrayList <String> finalCombined = new ArrayList();
ArrayList <String> finalCombined = new ArrayList();
for (int cnt = 0; cnt < nbrOfStrings; cnt++)
{
int cnt2 = 0;
int gn, size, vowelUsed;
Random n1 = new Random();
size = 122-96;
//char cs[] = new char[strSize];
//String cs;
//cs = "";
ArrayList <Character> cs = new ArrayList();
int counter = 0;
vowelUsed = 0;
while (counter < 1)
{
vowelUsed = n1.nextInt(vowelCnt + 1);
if (vowelUsed == 0)
{
}
else
{
counter = 2;
}
}
while (cnt2 < (strSize - vowelUsed))
{
gn = n1.nextInt(size) + 97;
if (gn == 97 | gn == 101 | gn == 105 | gn == 111 | gn == 117 | gn == 121)
{
}
else
{
cs.add((char)gn);
//cs += ((char)gn + "");
cnt2 ++;
}
}
while (cnt2 < strSize)
{
gn = n1.nextInt(size) + 97;
if (gn == 97 | gn == 101 | gn == 105 | gn == 111 | gn == 117 | gn == 121)
{
cs.add((char)gn);
//cs += ((char)gn + "");
cnt2 ++;
}
}
//int check;
//check = list.add(cs[cnt]);
Collections.shuffle(cs);
String combined;
combined = "";
//System.out.println(cs);
int counter2 = 0;
while (counter2 < strSize)
{
combined += cs.get(counter2);
counter2 ++;
}
finalCombined.add(combined);
counter2 = 0;
combined = "";
} // end # strings
for (int counter3 = 0; counter3 < nbrOfStrings; counter3++)
{
list.add(finalCombined.get(counter3));
}
} // end method
}