Programming Exercise


graphics/pe_icon.gif
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 instead of class Print .



A Programmer[ap]s Guide to Java Certification
A Programmer[ap]s Guide to Java Certification
ISBN: 201596148
EAN: N/A
Year: 2003
Pages: 284

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net