Question: Choose the appropriate method for each class. ClassA: public class ClassA implements Comparable { private String var; public ClassA ( String var ) { this.var

Choose the appropriate method for each class.
ClassA:
public class ClassA implements Comparable{
private String var;
public ClassA(String var){
this.var = var;
}
public String getVar(){
return var;
}
public int XXX(ClassA o){
return var.XXX(o.var);
}
}
ClassB:
public class ClassB implements Comparator {
@Override
public int YYY(ClassA o1, ClassA o2){
return o1.getVar().length()- o2.getVar().length();
}
}
What should XXX and YYY be?
Group of answer choices
XXX is compare and YYY is compareTo
Both are compareTo
Both are compare
XXX is compareTo and YYY is compare

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!