Easy learning with example program codes

java reflection class

The java.lang.Class provides the methods to examine the runtime properties of the object including its members and type information. For every type of object, the JVM instantiates an immutable instance of java.lang.Class. Using reflection, we can get the metadata of a class at run time.


Commonly used methods of java.lang.Class class


Method Description
getName() It returns the class name
forName(String className) It loads the class and returns the reference of Class class.
newInstance() It creates new instance.
isInterface() It checks if it is interface.
isArray() It checks if it is array.
isPrimitive() It checks if it is primitive.
getSuperclass() It returns the superclass class reference.
getDeclaredFields() It returns the total number of fields of this class.
getDeclaredMethods() It returns the total number of methods of this class.
getDeclaredConstructors() It returns the total number of constructors of this class.
getDeclaredMethod(String name,Class[] parameterTypes) It returns the method class instance.


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki