Programming Exercise

7.1 Create a new program with a nested class named PrintFunc that extends class Print from Exercise 6.2. In addition to just printing the value, class PrintFunc should first apply a Function object on the value. Class PrintFunc should have a constructor that takes an instance of Function type as a parameter. The evaluate() method of class PrintFunc should use the Function object on its argument. The evaluate() method should print and return the result. The evaluate() method in superclass Print should be used to print the value.

The program should behave like the one in Exercise 6.2, but this time use the nested class PrintFunc ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.