GetCountry method error

Can anyone give an idea of ​​why the code is not working? the problem is in the participating countries[numCountries]=newCountry;

I'm not sure why he continues to say that type mismatch cannot convert Country[]to a country, but I thought mine countries[numCountries]had a type Country[]since I already called it in the second line of code like this type?

public class World{

private Country[] countries;
private int numCountries=0;

public boolean addCountry(Country[] newCountry){
    if(!(newCountry==null)){
        countries[numCountries]=newCountry;     //the newcountry part doesnt work, red zigzag line underlining it here im not sure why
        numCountries++;
        return true;
    }
    else
        return false;

       }


}
+3
source share
2 answers

, a, , , , []. , , , , - . , , . if.

, , addCountries(Country[] newCountries). , , .

, - .

+3

, addCountry, , , , .

, :

public boolean addCountry(Country newCountry){
    ....
}
+3

All Articles