Tuesday, 12 December 2017

Reflection in Java Tutorial

Introduction

In this topic we will see what is Reflection in Java, what is it's importance and how to get started with it.

Reflection:

In simple words Reflection is the ability of a program to examine and modify the structure and behavior of an object at run-time.
It is used in Programs which needs to examine or modify the run-time behavior of applications running in JVM (Java Virtual Machine).

There is one more concept comes under it called Introspection.

Introspection is the ability of program to examine types or the properties of an object at run-time.
From the definition introspection is a subset of reflection.

Some of the languages like C++ supports Introspection, but not Reflection.

So now to conclude both these concepts,
Introspection on unknown object helps to examine the structure of the object,
whereas,
Reflection on unknown object helps to examine, modify the structure and behavior of object at run-time.

No comments:

Post a Comment