• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us

Java Reflection

Get Methods Return Type using Reflection

March 16, 2014 //  by Krishna Srinivasan

In this example we shall explain with a simple example to get the methods of a class using the reflection and get the return type. You can list the public and private methods of an object using the following steps: Get the Class instance of the class which you want to list the methods. In …

Category: JavaTag: Core Java, Java Reflection

Get Constructors using Reflection

March 16, 2014 //  by Krishna Srinivasan

This example shows how to get the constructors in a class and invoke it. Note that java.lang.reflect.Constructor defines a method newInstance() which is used for creating instance for an object. Before that you have to get the list of constructors in a class. We have two methods defined in the Class class. If we use …

Category: JavaTag: Core Java, Java Reflection

Get Super Class Name using Reflection

March 16, 2014 //  by Krishna Srinivasan

With this example, we shall show you how to get the super class of an object and use it using the reflection technique. Lets look at the following example and the steps provided below to understand the program. I have created Employee super class and its sub class Manager Created instance of Manager and assigned …

Category: JavaTag: Core Java, Java Reflection

Get Modifiers of an Object using Reflection

March 16, 2014 //  by Krishna Srinivasan

This example demonstrates how to get the modifiers used in a class using the reflection API. One can use the getModifiers() method in the Class object to know about each modifier used in that specific class. Call isAbstract(int mod), isFinal(int mod), isInterface(int mod), isNative(int mod), isPrivate(int mod), isProtected(int mod), isPublic(int mod) and isStatic(int mod) methods to …

Category: JavaTag: Core Java, Java Reflection

Get Package Name using Reflection

March 16, 2014 //  by Krishna Srinivasan

This example demonstrates how to get the package name using the Reflection API. With reflection we can get the details of any class or object and its methods, fields, etc. This is useful when we are doing the dynamic creation of the classes and invoking at run time. Lets look at the example program to …

Category: JavaTag: Core Java, Java Reflection

Get Methods using Reflection

March 16, 2014 //  by Krishna Srinivasan

In this example we shall explain with a simple example to get the methods of a class using the reflection. You can list the public and private methods of an object using the following steps: Get the Class instance of the class which you want to list the methods. In this example get the Class …

Category: JavaTag: Core Java, Java Reflection

Get Fields using Reflection

March 16, 2014 //  by Krishna Srinivasan

In this example we shall explain with a simple example to get the fields of a class using the reflection. You can list the public and private fields of an object using the following steps: Get the Class instance of the class which you want to list the fields. In this example get the Class …

Category: JavaTag: Core Java, Java Reflection

Invoke Method using Reflection API

March 16, 2014 //  by Krishna Srinivasan

This example highlights the way how to invoke a method using the reflection API. As we are aware that we can dynamically invoke a method in another class by using the reflection classes. Note that using reflection is more expensive in terms of performance. This programming practice is used only in the certain requirements where …

Category: JavaTag: Core Java, Java Reflection

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

How to Use Math.min() Method in Java?

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact