AbstractCollection already overrides toString() to print the contents of its elements. So, just list.toString() prints the toString() of all its elements. This is true for all collections.
public StringBuilder append(Object obj)
Appends the string representation of the Object argument.
List vegetables = new ArrayList<> () ;
vegetables.add ("Kale");
vegetables.add (0, "Lettuce");
System.out.println (vegetables);
List fish = new ArrayList<> ();
fish.add ("Salmon");
fish.add(0, "Seabass");
System.out.println(fish);
Tested: C.
This section is not available anymore. Please use the main Exam Page.1z0-819 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
preachr
9 months, 4 weeks agoASPushkin
1 year agof91f9be
1 year, 4 months agod7bb0b2
1 year, 6 months agoTheOneAboveAll
1 year, 8 months agoOmnisumem
1 year, 9 months ago[Removed]
1 year, 10 months agoStavok
1 year, 11 months agoAshan_Ozlov
1 year, 9 months agoObalt
2 years, 4 months ago