Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Main {
    public static void main(String[] args) {
        Method[] methods = java.lang.Integer.class.getDeclaredMethods();

        for (int i = 0; i < methods.length; i++) {
            Method m = methods[i];
            Class retType = m.getReturnType();
            Class[] paramTypes = m.getParameterTypes();
            String name = m.getName();
            System.out.print(Modifier.toString(m.getModifiers()));
            System.out.print(" " + retType.getName() + " " + name + "(");
            for (int j = 0; j < paramTypes.length; j++) {
                if (j > 0)
                    System.out.print(", ");
                System.out.print(paramTypes[j].getName());
            }
            System.out.println(");");
        }
    }
}