A collection like ArrayList students could contain two or more references to the same object (same student

Question:

A collection like ArrayList students could contain two or more references to the same object (same student enrolled in more than one course). Therefore, students.size() would not necessarily return the total number of distinct Student objects in a school’s student body. However, all Java collection framework classes have constructors that create the current type of collection from any other type of collection. Given the declaration:

int totalStudents;

Provide a single statement that assigns to totalStudents the total number of distinct Student objects in the students collection.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: