java的个题目求解

来源:百度知道 编辑:UC知道 时间:2024/05/25 01:22:11
Question 3 - Conditional Statements

x = 3;
if ( x < 5 ) {
System.out.println("x is less than 5");
} else {
System.out.println("x is greater than 5");
}

a. Is the code above correct? Explain your answer. (3 marks)

b. If the else branch is taken in a block of code, what does that say about every other condition statement on all of the other branches? (1 mark)
a 会做
请回答下b 谢谢了
怎么发到英文版块 谢谢

i think the answer is ,this code is correct ,because x is a global variable ,and x is less than 5 ,so system will print "x is less than 5",if i am wrong ,parden me,my answer is only a reference.
what's more ,you should see the class and the position of this code

太高深了,不懂。
看代码,没问题。
int x=3; 除了没有声明变量。

应该发到英语的版块中

- -!~ 英文水平有限