public class d {
public static void main(String[] args) throws IOException {
System.out.println(xxxx.test);
}
}
class xxxx{
public final static String test="abc";
static{
System.out.println("111");
}
}
为啥结果为:
abc
那个111怎么不打出来?????
...全文
27317打赏收藏
奇怪的问题
public class d { public static void main(String[] args) throws IOException { System.out.println(xxxx.test); } } class xxxx{ public final static String test="abc"; static{ System.out.println("111"); } } 为啥结果为: abc 那个111怎么不打出来?????
class xxxx{
xxxx(){
System.out.println(this.getClass().getClassLoader());
}
public final static String test="abc";
static{
System.out.println("111");
}
}
public class tt extends ClassLoader{
public static void main(String[] args)throws Exception {
new xxxx();
tt t=new tt();
System.out.println(t.findLoadedClass("xxxx"));//为什么总是返回null???
}
}