该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
package TextReflection;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
public class testReflection {
public static void main(String arg[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
String str = "TextReflection."+"TT";
Class c = Class.forName(str);
Object o = c.newInstance();
Method method[] = c.getMethods();
for(Method m:method) {
System.out.println(m.getName());
}
}
}
}
我的类定义如下:
class TT {
static {
System.out.println("TT is loaded");
}
int i;
TT() {
System.out.println("TT is constructed");
}
void m() {
System.out.println("TT");
}
void m2(int i ,int j) {
System.out.println(i+j);
}
}
为什么输出的结果是:
TT is loaded
TT is constructed
wait
wait
wait
equals
toString
hashCode
getClass
notify
notifyAll
我想问问我的m()跟m2()方法到哪去了,谢谢