How can a class that implements an interface return another interface in a method?

9 hours ago 1
ARTICLE AD BOX

I am sorry for asking this, but I am very confused. I am creating a project where I compare various sorting methods (such as Selection Sort, Bubble Sort, and Merge Sort). It asks me to create two interfaces, one called ISorter and one calle ISortStats. ISorter has a method that returns the interface ISortStats, how does that work? And, is it possible for an object that implements ISorter can return ISortStats in a method? (The interfaces were already given to me in the assignment). I am supposed to implement ISorter on each of my sorter classes. I ask that you please don't give me the answers and try to explain.

Thanks!

public interface ISorter { public SortStats sort(int[] a); } public interface ISortStats { String getAlgorithm(); int getNumItems(); int getNumComparisons(); int getNumMoves(); long getNumNanoseconds(); }
Read Entire Article