Top


定義場所(file name)

jdk/src/share/classes/java/lang/Class.java

説明(description)

    /**
     * Returns the {@code Class} object associated with the class or
     * interface with the given string name.  Invoking this method is
     * equivalent to:
     *
     * <blockquote>
     *  {@code Class.forName(className, true, currentLoader)}
     * </blockquote>
     *
     * where {@code currentLoader} denotes the defining class loader of
     * the current class.
     *
     * <p> For example, the following code fragment returns the
     * runtime {@code Class} descriptor for the class named
     * {@code java.lang.Thread}:
     *
     * <blockquote>
     *   {@code Class t = Class.forName("java.lang.Thread")}
     * </blockquote>
     * <p>
     * A call to {@code forName("X")} causes the class named
     * {@code X} to be initialized.
     *
     * @param      className   the fully qualified name of the desired class.
     * @return     the {@code Class} object for the class with the
     *             specified name.
     * @exception LinkageError if the linkage fails
     * @exception ExceptionInInitializerError if the initialization provoked
     *            by this method fails
     * @exception ClassNotFoundException if the class cannot be located
     */

名前(function name)

    public static Class<?> forName(String className)
                throws ClassNotFoundException {

本体部(body)

  {- -------------------------------------------
  (1) java.lang.Class.forName0() を呼び出し, 結果をリターンするだけ.
      ---------------------------------------- -}

            return forName0(className, true, ClassLoader.getCallerClassLoader());
        }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.