Page 881 - AP Computer Science A, 7th edition
P. 881

26. (B) Segment III is wrong because you can’t construct an interface object. Segments I and II both work because the minThree method is expecting three parameters, each of which is an Orderable. Since Temperature implements Orderable, each of the Temperature objects is an Orderable and can be used as a parameter in this method. Note that the program assumes that the compareTo method is able to compare Temperature objects with different scales. This is an internal detail that would be dealt with in the compareTo method, and hidden from the client. When a class implements Orderable there is an assumption that the compareTo method will be implemented in a reasonable way.


































































































   879   880   881   882   883