関数 generatecode() を使用したときに static を使用できないというエラーを参照しています。分割が正しく行われたかどうかを確認したかったのです。私は新しく、まだ少し助けが必要です。この場合、次のようにして新しいクラスを作成する方法を見てきました: TestFile variable = new TestFile(); これが何を意味するのかわかりませんでした。ありがとう!
public class TestFile {
String[] preps = {
"about", "above", "across", "after", "against",
"along", "among", "around", "at", "before",
"behind", "below", "beneath", "beside", "between",
"by", "concerning", "down", "during", "except",
"for", "from", "in", "inside", "into",
"like", "near", "of", "onto", "out",
"over", "through", "to", "toward", "under",
"up", "upon", "with", "within", "without"
};
String[] errorpreps = {
"will", "would", "shall", "should", "can",
"could", "may", "might", "must",
};
String[] question = {
};
public static void main(String[] args) {
generatecode("hi");
};
public generatecode(String code){
String prep = "";
for (int i=0; i<preps.length; i++){
prep = prep + preps[i];
}
System.out.println(prep);
return prep;
}
public String printcode(String code){
return "";
}
}