// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.lang.reflect.*;
import java.util.*;

public class ArrayOfMethodsReflection {
    public static void main(String[] args)throws Exception  {
        Map<String, Method> m = new HashMap<String, Method>();
        for (Method met : ArrayOfMethodsReflection.class.getMethods()) {
            m.put(met.getName(), met);
        }
        m.get("a").invoke(null, new Object[] { });
        m.get("b").invoke(null, new Object[] { });
    }
    public static void a() {
        System.out.println("I am a");
    }
    public static void b() {
        System.out.println("I am b");
    }
}
