Start of Tutorial |
Search
Feedback Form |
Method
objects
of the reflection API in the same way.
Resist the temptation!
Your program will be easier to debug and maintain if you
don't use Method
objects.
Instead,
you should define an interface, and then implement it
in the classes that perform the needed
action.
Other trails use the term "member variable"
instead of "field."
The two terms are synonymous.
Because the Field
class is part of
the reflection API, this trail uses the term "field."
This trail uses a task-oriented approach to the reflection API. Each lesson includes a set of related tasks, and every task is explained, step by step, with a sample program. The lessons are as follows:
Examining Classes explains how to determine the class of an object, and how to get information about classes and interfaces.
Manipulating Objects shows you how to instantiate classes, get or set field values, and invoke methods. With the reflection API, you can perform these tasks even if the names of the classes, fields, and methods are unknown until runtime.
Working with Arrays describes the APIs used to create and to modify arrays whose names are not known until runtime.
Summary of Classes
lists the classes that comprise the reflection API, and provides links
to the apppropriate API documentation.
Start of Tutorial |
Search
Feedback Form |
Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.