package reflection12;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Aufruf von Klassenmethoden.
 * 
 * @author  Ralf Kunze (rkunze@uos.de), Institut fuer Informatik, Universitaet Osnabrueck
 * @date 02.06.2007
 */
public class MethodenTest {

    public static void main(String[] args) {
        
        Class<Math> c = Math.class;
        try {
            

            Method m = c.getMethod("random");
            double d = (Double)(m.invoke(null));
            System.out.println(d);
            
            double x = 10;
            double y = 3;
            m = c.getMethod("pow", Double.TYPE, Double.TYPE);
            d = (Double)(m.invoke(null, x, y));
            System.out.println(d);
            
            
            
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        
    }

}
