This class represents a Java type. There
Class object for each class that is loaded
into the Java Virtual Machine, and, as of Java 1.1, there are special
Class objects that represent the Java primitive
TYPE constants defined by
Integer, and the other
primitive wrapper classes hold these special
objects. Array types are also represented by
objects in Java 1.1.
There is no constructor for this class.
You can obtain a
Class object by calling the
getClass( ) method of any instance of the desired
class. In Java 1.1 and later, you can also refer to a
Class object by appending
.class to the name of a class. Finally, and most
interestingly, a class can be dynamically loaded by passing its fully
qualified name (i.e., package name plus class name) to the static
This method loads the named class (if it is not already loaded) into
the Java interpreter and returns a
for it. Classes can also be loaded with a
method creates an instance of a given class; this allows you to
create instances of dynamically loaded classes for which you cannot
new keyword. Note that this method works
only when the target class has a no-argument constructor. See
newInstance( ) in
java.lang.reflect.Constructor for a more powerful
way to instantiate dynamically loaded classes. In
Class is a
generic type and the type variable
T specifies the type that is returned ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.