public class TestRelection {
public static void main(String[] args) {
String str = "T";
try {
Class.forName(str); //把名为str的类装载到内存
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
class T {
static {
System.out.println("loader");
}
int i;
String string;
public void m1(int i) {
this.i = i;
}
public String getS() {
return string;
}
}
3 回答
添加回答
举报
0/150
提交
取消