求问几道基础的java题目,
问题描述:
求问几道基础的java题目,
Assume x = 4 and y = 5,Which of the following is true?
A.x B.x C.x > 5 && y > 5
D.x > 5 || y > 5
————————————————————
Assume x = 4,Which of the following is true?
A.(x == 4)
B.x = 4
C.x == 5
D.x = 5
——————————————————————
Which of the following is equivalent to x =
A.(x = y)
B.x > y && x C.x > y || x D.x >= y || x
10) && (x-- > 10)?
A.9
B.10
C.11
D.12
——————————————————
Suppose x=10 and y=10 what is x after evaluating the expression (y >=
10) || (x-- > 10)..
A.9
B.10
C.11
D.12
答
&&是逻辑与的意思,两边条件都成立的就是true,不然就是false
||是逻辑或的意思,只要有一边成立就是true,两边都不成立就是false
答案是
1、B
2、D ,!(x == 4) 和 x != 4其实是同一种效果
3、C ,只要两边无交集就行
4、B ,&&左边短路了,没有调用了x--了
5、B,y>=10已经成立,后边的部分不会执行了
如果能帮助到你,希望采纳