Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

kx *g1: Write a public interface namedFundamentalInterface with abstract methods

ID: 3708896 • Letter: K

Question

kx *g1: Write a public interface namedFundamentalInterface with abstract methods named"bed * "tender", "shit", and "vote" all of which take no parameters and have return type int Then write a public class named FundamentalComparator that implements the Comparator * interface with FundamentalInterface as the type parameter. Then implement the compare * method such that it will sort instances that implement FundamentalInterface by the return value of "bed" in increasing order when used as the comparator in a call to *Collections.sort

Explanation / Answer

public interface FundamentalInterface { int bed(); int tender(); int shit(); int vote(); } import java.util.Comparator; public class FoundamentalComparator implements Comparator { @Override public int compare(FundamentalInterface f1, FundamentalInterface f2) { return Integer.compare(f1.bed(), f2.bed()); } }