Question: Fill in the blank to make this code compile: A. compare(Truck t) B. compare(Truck t1, Truck t2) C. compareTo(Truck t) D. compareTo(Truck t1, Truck t2)
Fill in the blank to make this code compile:

A. compare(Truck t)
B. compare(Truck t1, Truck t2)
C. compareTo(Truck t)
D. compareTo(Truck t1, Truck t2)
E. None of the above.
public class Truck implements Comparable { private int id; public Truck (int id) { this. id = id; } } @Override public int } return id - t.id; - {
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
The image shows a Java class defining a Truck which implements the Comparable interface The Comparab... View full answer
Get step-by-step solutions from verified subject matter experts
