(单选题)7: What happens when you try to compile and run the following program?
class Mystery{String s;
public static void main(String[] args){
Mystery m=new Mystery();m.go();}
void Mystery(){s="constructor";}
void go(){Syste
(
单选题)7: What happens when you try to compile
and run the following program?
class Mystery{String s;
public static void main(String[] args){
Mystery m=new Mystery();m.go();}
void Mystery(){s="constructor";}
void go(){System.out.println(s);}
}
A: this code will not compile
B: this code compliles but throws an exception at runtime
C: this code runs
and "constructor" in the st
andard output
D: this code runs
and writes "null" in the st
andard output
(责任编辑:admin)
有不懂可以加客服微信:vq800020900 咨询