Given the Person class with age and name along with getter and setter methods, and this code fragment:
What will be the result?
Given the Person class with age and name along with getter and setter methods, and this code fragment:
What will be the result?
The given code sorts the list first by age in descending order due to the reversed() method and then by name in ascending order. The three Person objects have ages 44, 40, and 40 respectively. Tom has the highest age of 44, so he comes first. For the other two persons with an age of 40, the names are sorted in ascending order. The sorting results in Tom, Peter, and Aman.
D is true