猿问

帮忙看看这个Java反射机制的例子哪里错了啊

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;
    }
}


fenkapian
浏览 1282回答 3
3回答

慕的地8582982

OABOVWKZTOBCVQTMAPQJRSGGNICCOBIJETZMMGNIVHCKXDEZHJQSXLTTMMANHOIIWRXDQXMGAAAIWYEMAUOVITOINVWKFMGBVWRDLLMGUOCVJXIIKYSLRYLFUBWXLTNKYEZSBONNJYRFYGCPCDEFMGGAAGQJDSRYSMMHUDBWFYZGNNOIDBIIXLGAGOCYSLMVJCWJMNDWLGFZMHBQYVVOPRSFZTUVJBDYFTTPPQXHNAJKKLFSAWDDPCJXLNNHUZAAIBPKZMNIXDDZTHVPABDZSAOVXELLNNSDXLNNHIBRGNUNOJDEZGBIUABPWDDZFTHNNNCWYMMGABZTZHOPQXDLLZGMNHVQWJKFKKQXLMGAMPWYRFYSNBIBIRVCDFEFZTTHHZTCDCCYGGVJFGANHVPDXRLRXGIJKFTYTBTMSICCJQDSAZSGGCJFSFZSGMNBDYAATHNRXQRYZNUNUUOHJYLELSSTPREEMHVICJDRKQWXRUPWJYZDYGMSTUCCWSVBDXKLAICELTTGAHXELKNONGFMUJXYLVWUBHDXEQEYHVVPRSSTIWDLNBUPRAOKRQLEBWQQPWQEXSMKVIWJJMZFAIMSUVJCPQKMATMMICCWDQDFVBOOILZNGODLXEYMAUUONOIJCSGPXSSFAJKZZFTJJJMMQJWYLBBCOPWZFESZZGCPWXLRLVPRPORZUNGTUBWRRLGBIHNBIJXLYMGGOVICQXREHUYERFMZAVVXLFFZANMZTTCQEKZZNPYMFZOLRRFXTOQDRYBWJJXMGNTNVOHBQYSZOOJQYFSTHAVDQDKCJCRFMGHNUPGMTAUBNBUPDWPQMNHPJWJYRXXYLHHVUNQEXETHTABUOQNVEWCPKQYEWRWIEDCSMRNJ

忘性最大的人

string还未初始化。
随时随地看视频慕课网APP

相关分类

Java
我要回答