【123】运行以下Java代码,正确的输出结果是( )。
public class Test {
private int i = 0;
private int j = 1;
private boolean returnTrue(){
System.out.println("return true");
return j > i;
}
private boolean returnFalse(){
System.out.println("return flase");
return i > j;
}
public static void main(String[] args) {
Test test = new Test();
if(test.returnFalse() && test.returnTrue()){
System.out.println("test");
}
}
}
(选择一项)
A) return truereturn flase
B) return flasereturn true
C) return flase
D) return truereturn flasetest
【参考答案】:C
求解!
public class Test {
private int i = 0;
private int j = 1;
private boolean returnTrue(){
System.out.println("return true");
return j > i;
}
private boolean returnFalse(){
System.out.println("return flase");
return i > j;
}
public static void main(String[] args) {
Test test = new Test();
if(test.returnFalse() && test.returnTrue()){
System.out.println("test");
}
}
}
(选择一项)
A) return truereturn flase
B) return flasereturn true
C) return flase
D) return truereturn flasetest
【参考答案】:C
求解!