Quantcast
Browsing latest articles
Browse All 10 View Live

Get Fields from an Object

In this example we shall show you how to get the fields of a class represented by an object. To get the fields of a class represented by an object one should perform the following steps: Get an array...

View Article


Get Methods from an Object

This is an example of how to get methods of an Object. Getting the methods of an Object implies that you should: Get the array containing Method objects reflecting all the public member methods of the...

View Article


Invoke Method with reflection

With this example we are going to demonstrate how to invoke a method using reflection. In short, to invoke a method using reflection you should: Create a new StringBuilder with no characters in it and...

View Article

Get Modifiers from an Object

In this example we shall show you how to get the modifiers of a class. To get the modifiers of a class one should perform the following steps: Call getModifiers() API method of Class to get the Java...

View Article

Get methods return type

This is an example of how to get the return type of a classe’s methods. To get the return type of a classe’s methods one should perform the following steps: Get the array of Method objects reflecting...

View Article


Get class from an object

In this example we shall show you how to get the class of an Object. To get the class that represents an Object one should perform the following steps: Create a new Object. Get the class of the Object,...

View Article

Get super class of an object

With this example we shall show you how to get the super class of an object. To get the super class of an object implies that you should: Create a new Object. In the example we first create a new...

View Article

Get package name

This is an example of how to get the package name of a class. Getting the package name of a class implies that you should: Create a new object of the class. Use getClass() API method of Object for the...

View Article


Java Reflection Example

Java Reflection provides the ability to inspect and modify the runtime behavior of applications. Using reflection we can inspect a class or an interface, get their constructors, methods and fields...

View Article


java.lang.reflect.Array Example

In this example we shall explain how to use java.lang.reflect.Array. The java.lang.reflect.Array class provides static methods to dynamically create and access Java arrays. Arrays are objects that...

View Article
Browsing latest articles
Browse All 10 View Live