Inspecting using Reflection package

do not need to turn in

Below is a program from a java text book that prints out the methods of a class using the java.lang.reflect pakcage. Program it and be able to explain what is happening. In what package does the Class and Method classes belong? Where is the getClass() method of Random class inherited from?

import java.lang.reflect.*;

import java.util.Random;



class SeeMethods {

    public static void main(String[] arguments)  {

        Random rd = new Random();

        Class className = rd.getClass();

        Method[] methods = className.getMethods();

        for (int i = 0; i < methods.length; i++) {

            System.out.println("Method: " + methods[i]);

        }

    }

}



}