Name

This application asks the Mystery class for its name and prints the resuslt.

import java.lang.reflect.*;

public class ReflectName {


  public ReflectName  ()  {

    super ();

  }  // end ReflectName constructor

  public static void main ( String [ ] args )  {

    try  {

        Class theClass = Class.forName("Mystery");
        String s = theClass.getName();
        System.out.println("Name of class: " + s);

    } // end try

    catch ( ClassNotFoundException e ) {
        System.out.println ( "Class not found: " + e );
    }


  }  // end main


}  // end ReflectName