This is how you should do it
Code:public class Test { public static void main(String[] args) throws Exception { Class<?> c = Class.forName("TestPlayer"); Object o = c.newInstance(); String x = (String) c.getMethod("getUsername", (Class[]) null).invoke(o, (Object[])null); System.out.println(x); } }




Reply With Quote