Trying to get the return function to return the full array, but not able to do it with a for loop or without. Is there any way to get this done?
public class Teams {
String Game;
String Coach;
String Player[];
public void setPlayer(String a[])
{
for (int i = 2; i<10; i )
{
Player[i-2] = a[i];
}
}
public String getPlayer()
{
for(int i = 0; i < 8; i )
{
return Player[i];
}
}
}
CodePudding user response:
There's nothing special about arrays - you can return the member as is:
public String[] getPlayer() {
return Player;
}