Page 1 of 1

(iii) You have been given the following code for the Team class toString() method: public String toString() { String tem

Posted: Fri Jun 10, 2022 11:56 am
by correctanswer
(iii) You have been
given the following code for the Team class toString() method:
public String toString()
{
String temp = "Team " +
name +
" has the following
players:\n";
for (int i = 0; i <
numOfPlayers; i++)
{
temp =
temp + players.toString() + "\n";
}
return temp;
}
Suppose that the
following code is executed as a test:
Team myTeam = new Team();
System.out.println(myTeam);
State
what output you would expect to see and explain your
answer.