(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.
(iii) You have been given the following code for the Team class toString() method: public String toString() { String tem
-
- Posts: 43759
- Joined: Sat Aug 07, 2021 7:38 am