Java Reflection Tutorial

About Ryan Wang

In this tutorial, I mainly write some examples to introduce what Java reflection can do. Hopefully, it can give you an overview of this concept. Please leave your comment for suggestions.

What is Reflection?

In brief, reflection is the ability of a program to examine and modify the structure and behavior of an object at runtime.

This concept is sometimes mixed with introspection. Introspection (Type introspection) is the ability of a program to examine the type or properties of an object at runtime. Therefore, it is a subset of reflection. Some languages support introspection, but do not support reflection, e.g., C++.

Why do we need reflection?

Reflection enables us to do the following:


Source : http://www.javacodegeeks.com/2013/09/java-reflection-tutorial.html

Back to Top