Answer Posted / naresh
/**
* Returns the <code>Class</code> object associated with
the class or
* interface with the given string name. Invoking this
method is
* equivalent to:
*
* <blockquote><pre>
* Class.forName(className, true, currentLoader)
* </pre></blockquote>
*
* where <code>currentLoader</code> denotes the defining
class loader of
* the current class.
*
* <p> For example, the following code fragment returns the
* runtime <code>Class</code> descriptor for the class named
* <code>java.lang.Thread</code>:
*
* <blockquote><pre>
* Class t = Class.forName("java.lang.Thread")
* </pre></blockquote>
* <p>
* A call to <tt>forName("X")</tt> causes the class named
* <tt>X</tt> to be initialized.
*
* @param className the fully qualified name of
the desired class.
* @return the <code>Class</code> 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
*/
public static Class<?> forName(String className)
throws ClassNotFoundException {
return forName0(className, true,
ClassLoader.getCallerClassLoader());
}
Source: Source code copied from Class class of JDK 1.6.
Hope this would be useful.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between long.class and long.type?
Is “abc” a primitive value?
Why use POJO when I can use hashmap
In our urls and in the text of the buttons we have comma. Its causing an error. Is there a way to change the delimiting character for the menu arguments?
When a thread blocks on i/o?
What are the difference between RMI and CORBA?
How are the elements of a borderlayout organized?
What is jboss?
Explain the steps in details to load the server object dynamically?
What is in-memory replication?
What is a sessionfactory? Is it a thread-safe object?
Difference between loadclass and class.forname?
What’s jboss cache in short?
What is the purpose of the notify() method?
Do I have to use jsps with my application?