Reflection API is a collection of classes and interfaces given by SUN ,to get a meta data of a class at runtime. For example, we have a runtime class and
Every time a class was loaded into JVM , JVM creates a java.lang.Class object with the name ‘class’ in that class , that contains all the meta data of loaded
In this article we wre going to learn how to get class name of given object. package com.java; public class Sample { public void printClassName(Class c){ String cname = c.getName();
In this tutorial we are going to check wheather loaded class is an interface definition or class definition . To check weather the .class file is as interface definition or
In this tutorial we are going to learn , how to get all super classes of a class . To get super class of a class , getSuperclass() method was
In this tutorial we are going to learn hot get interfaces implemented by class at run time . To get interfaces implemented by class , getInterfaces() method was provided in
In this tutorial we are going to learn how to get all fields of a class . To get fields of a class , getDeclaredFields() method was provided in java.lang.Class
In this tutorial we are going to learn how to get constructor and it’s parameter of a class . See the below example . package com.java; import java.lang.reflect.Constructor; class Sample
In this tutorial we are going to learn how to get method details of a class . In java, methods are classified into two types they are . 1) Instance
Package is collection of classes , interfaces and sub packages. Package must be a first statement of a class. To get package details getPackage() method is given in java.lang.Class .
In java, many modifiers are there, those are: 1) private2) protected3) public4) default5) Abstract6) Final7) Synchronised8) Volatile9) Static10) Native11) Transient default is not a keyword. If you don’t specify any