Multiple Choice
For the questions below, consider a class called ChessPiece. This class has two instance data, String type and int player. The variable type will store "King", "Queen", "Bishop", etc and the int player will store 0 or 1 depending on whose piece it is. We wish to implement Comparable for the ChessPiece class. Assume that, the current ChessPiece is compared to a ChessPiece passed as a parameter. Pieces are ordered as follows: "Pawn" is a lesser piece to a "Knight" and a "Bishop", "Knight" and "Bishop" are equivalent for this example, both are lesser pieces to a "Rook" which is a lesser piece to a "Queen" which is a lesser piece to a "King."
-Which of the following method headers would properly define the method needed to make this class Comparable?
A) public boolean comparable(Object cp)
B) public int comparable(Object cp)
C) public int compareTo(Object cp)
D) public int compareTo( )
E) public boolean compareTo(Object cp)
Correct Answer:

Verified
Correct Answer:
Verified
Q1: Modifying a program in order to eliminate
Q2: An object that refers to part of
Q11: In what way is black-box testing better
Q23: Explain the difference between implementing an interface
Q34: Write a static method that is passed
Q34: The goal of testing is to<br>A) ensure
Q36: Which Layout Manager type would you use
Q37: Draw the JFrame as you think it
Q39: Static methods cannot<br>A) reference instance data<br>B) reference
Q42: Which Layout Manager type would you use