Hi All. I have a question about the java interface signature. I wasgiven the fol
ID: 3617258 • Letter: H
Question
Hi All.I have a question about the java interface signature. I wasgiven the following code
public interface Top-N {
public Set<Tuple> topN(stringQ,int K, Score F)
}
public class TopNImpl implements TopN{
public Set<Tuple> topN(stringQ, int K, Score F)
}
I am not sure what the Set<tuple> is used for in interfacesignature definition. Is this a way to inherit all thefunctionality from class Tuple?
I have a class Tuple defined
and an interface Score and ScoreImpl
Any help would be appreciated. Thx.
Explanation / Answer
publicinterface TopN { publicSettopN(String Q,int K, Score F) } The Setis the return type of the method. When you implement it, you will need to return a Set. public class TopNImplimplements TopN { publicSettopN(String Q, int K, Score F){returnnull;} }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.