A.程序输出的结果是hello你好
B.程序输出的结果是hello
C.程序输出的结果是ok
D.程序输出的结果是你好
参考解析:对于程序
public class Test {
public static void main (String args[ ]) {
boolean boo = false;
if(boo = true){
System.out.print("hello");
System.out.print("你好");
}
else {
System.out.print("ok");
System.out.print("yes");
}
}
}
输出结果为hello你好。
并且忘记条件表达式的值必须是 boolean类型。
条件控制语句中的if操作以及else操作都是一个语句,好习惯是用一个复合语句来表示。
第1题
A.public class test { public int x=0; public test(int x) { this.x=x; } }
B.public class Test { public int x=0; public Test(int x) { this.x=x; } }
C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }
D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }
第2题
A.对象被创建后,立刻变成垃圾对象
B.任何不再被引用的对象都是垃圾收集的对象
C.一旦对象失去引用,垃圾收集器立刻把它从内存中清除
D.Java对象的清除必须自己手动处理
第4题
B、写好的java源程序可以直接运行
C、编写的源程序必须先编译后才能运行
D、程序员可以读懂扩展名为.class的文件
第5题
B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }
C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }
D.public class
第7题
A.public class test{ public int x=0; public test(int x ) { this.x=x; } }
B.public class Test { public int x=0; public Test(int x ) { this.x=x; } }
C.public class Test extends T1 T2 { public int x=0; public Test(int x){ this.x=x; } }
D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }
第8题
B.args[0] = "MyTest"
C.args[0] = "a"
D.args[1]= 'b'
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!