![]()
(chat, newsreader, calendar)
|
![]() |
|
|
|
Course Notes Table of Contents Exercises | Online Training Index
|
|
Help: Reflective Programming with Freud
MageLang Institute
|
|
Help is available for each task, or you can go straight to
the solution source code.
import java.lang.reflect.*; Task 2The skeleton code currently lists class variables and constructors of any class requested. It is your job to have it also list all the methods. The framework is included, you only need to complete the listClassMethods method.The Class.getDeclaredMethods method lists all methods of a class. The Class.getMethods method includes those methods inherited. Task 3Within listClassMethods: for each method of the class, list the modifiers, return type, name, and parameter types.
The Method.toString method could be used, but we do not want each method name prefixed by the name of the class it belongs to. The private getTypeName method can be used to display the various parameter types. If you do not use this method, you have to convert each array parameter type yourself. For those unfamiliar with PrintWriter, this is the 1.1 replacement class for PrintStream.
|
|
Copyright © 1997 MageLang Institute. All Rights Reserved May-97 Copyright © 1996, 1997 Sun Microsystems Inc. All Rights Reserved |