私はまだメソッドの使い方を学んでいますが、途中で別の切り株にぶつかりました。別の static void メソッドで static void メソッドを呼び出そうとしています。そのため、大まかに次のようになります。
public static void main(String[] args) {
....
}
//Method for total amount of people on earth
//Must call plusPeople in order to add to total amount of people
public static void thePeople (int[][] earth) {
How to call plusPeople?
}
//Method adds people to earth
//newPerson parameter value predefined in another class.
public static void plusPeople (int[][] earth, int newPerson) {
earth = [newPerson][newPerson]
}
私はいくつかの異なることを試しましたが、実際にはうまくいきませんでした。
int n = plusPeople(earth, newPerson);
//Though I learned newPerson isn't recognized
because it is in a different method.
int n = plusPeople(earth); \
//I don't really understand what the error is saying,
but I'm guessing it has to do with the comparison of these things..[]
int n = plusPeople;
//It doesn't recognize plusPeople as a method at all.
メソッドを呼び出すことさえできないのは非常にばかげていると思いますが、文字通りこの問題で約2時間立ち往生しています.