Java Class forName forName(final String className)

Here you can find the source of forName(final String className)

Description

Returns the Class object associated with the class or interface with the given string name.

License

LGPL

Parameter

Parameter Description
className the fully qualified name of the desired class.

Return

Class or null

Declaration

public static Class<?> forName(final String className) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**//from w w w .  j  av  a 2s  .  c o  m
     * Returns the <code>Class</code> object associated with the class or
     * interface with the given string name.
     * 
     * @param className
     *            the fully qualified name of the desired class.
     * @return <code>Class</code> or null
     */
    public static Class<?> forName(final String className) {
        try {
            return Class.forName(className);
        } catch (final ClassNotFoundException e) {
            return null;
        }
    }
}

Related

  1. forName(Class classType, String className)
  2. forName(final Class caller, final String className)
  3. forName(final String className, final Class caller)
  4. forName(String className)
  5. forName(String className)
  6. forName(String className)