Question: Suppose you have created a Student class compare To() method that is based on the value of a private idNum field. Assume the class contains
Suppose you have created a Student class compare To() method that is based on the value of a private idNum field. Assume the class contains a public getId () method that returns the idNum value. Also suppose that stu1’s idNum is 345 and that stu2’s idNum is 456. Which of the following returns 1?
a. Stu1.compareTo(stu2)
b. Stu2.compareTo(stu1)
c. Stu2.compareTo(stu1.idNum)
d. Stu1.getId().compare To (stu2.getId())
Step by Step Solution
3.43 Rating (159 Votes )
There are 3 Steps involved in it
b The compare To method returns 1 ... View full answer
Get step-by-step solutions from verified subject matter experts
