實在找不到原因
package study;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.lang.reflect.*;
public class TestReflection {
public static void main(String[] args) throws IOException,
ClassNotFoundException {
Class c = Class.forName("T");
}
}
class T {
int i;
String s;
static {
System.out.println("BT has load");
}
public T() {
System.out.println("BT has new");
}
public void t1(int i) {
this.i = i;
}
}
需要加上包名。改成Class.forName("study.T");