Solved

Consider the Following Class: Public Class Player Implements Comparable

Question 40

Multiple Choice

Consider the following class: public class Player implements Comparable
{
Private String name;
Private int goalsScored;
// other methods go here
Public int compareTo(Object otherObject)
{
__________________________________
Return (goalsScored - otherPlayer.goalsScored) ;
}
}
What statement can be used to complete the compareTo() method?


A) Player otherPlayer = otherObject;
B) Object otherPlayer = otherObject;
C) Player otherPlayer = (Player) otherObject;
D) Object otherPlayer = (Player) otherObject;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents