Question: a. Declare an interface Filter that has a method accept() which accepts as parameter an Object, and retur b. ns a Boolean. [3] c. Provide

 a. Declare an interface "Filter" that has a method accept()" which

a. Declare an interface "Filter" that has a method accept()" which accepts as parameter an Object, and retur b. ns a Boolean. [3] c. Provide an abstract class ShortWordFilter that implements the interface Filter". [3] d. Extend two concrete classes Less ThanFive and LessThanTen from ShortWordFilter class, such that both have an ArrayList of type String to store the words. [3] e. Define a static method "collectAll" that accepts as parameters two arguments, an arraylist of type String and a reference of type Filter. The method returns an arraylist of type Filter containing two polymorphic references to objects of the sub dasses containing ArrayList filled with words that are accepted by the given filter. [7] f. Then write a testclass that reads all words from System in, puts them into an ArrayList

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 Databases Questions!