The static method comparing() extracts a comparator that uses the getName() method of the Task class, and the default method…