Declare an interface Filter as follows: public interface Filter { boolean accept(Object x); } Add a Filter

Question:

Declare an interface Filter as follows:

public interface Filter { boolean accept(Object x); }

Add a Filter parameter to the average method of Section 9.6. Only objects that the filter accepts should be processed.  Demonstrate your modification by processing a collection of bank accounts, filtering out all accounts with balances less than $1,000.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java Concepts Late Objects

ISBN: 9781119186717

3rd Edition

Authors: Cay S. Horstmann

Question Posted: