REFLECTION.  An important Java language feature is reflection, a feature
also known as "introspection."  Reflection is the ability to query a Java
class about its properties, and to operate on methods and fields by name
for a given object instance.

You can use reflection to set object fields or invoke particular object
methods by name.  For example, given an object instance "obj," and a method
name "f5" specified at program execution time, the method can be invoked on
the instance.

To see how this works, look at this simple example:

        import java.lang.reflect.*;

        public class DumpMethods {
                public static void main(String args[])
                {
                        try {
                                Class c = Class.forName(args[0]);
                                Method m[] = c.getDeclaredMethods();
                                for (int i = 0; i < m.length; i++)
                                        System.out.println(m[i].toString());
                        }
                        catch (Throwable e) {
                                System.err.println(e);
                        }
                }
        }

For an invocation of:

        java DumpMethods java.util.Stack

the output is:

        public java.lang.Object java.util.Stack.push(java.lang.Object)
        public synchronized java.lang.Object java.util.Stack.pop()
        public synchronized java.lang.Object java.util.Stack.peek()
        public boolean java.util.Stack.empty()
        public synchronized int java.util.Stack.search(java.lang.Object)

That is, the method names of class java.util.Stack are listed, along with
their fully qualified return types and parameter types.

This program loads the specified class using class.forName, and then calls
getDeclaredMethods to retrieve the list of methods defined in the class.
The class java.lang.reflect.Method represents a single class method.

The reflection feature may not seem like much at first, but it's impossible
to do in other languages such as C, C++, or Fortran.  The names and
properties of functions in these other languages are gone by the time the
program is executed.  In technical terms, these other languages have "early