Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.lang.reflect.Constructor;
import java.lang.reflect.Member;
import java.lang.reflect.TypeVariable;

public class Main {
    public static void main(String[] args) throws ClassNotFoundException {
        Class c = Class.forName("java.util.List");

        Constructor[] constructors = c.getDeclaredConstructors();
        for (int i = 0; i < constructors.length; i++) {
            print_method_or_constructor(constructors[i]);
        }

    }

    public static void print_method_or_constructor(Member member) {
        Constructor c = (Constructor) member;
        TypeVariable[] parameters = c.getTypeParameters();

        for (int i = 0; i < parameters.length; i++) {
            System.out.println(parameters[i]);
        }
    }
}