Q- Given the code fragment:
int x = 10;
int y = ++x;
int z = 0;
if (y >= 10 | | y <= ++x) {
z = x;
else {
z = x++;
}
System.out.println(z);
What is the result?
A) 12
B) A compile time error occurs.
C) 10
D) 11
⧪ please give your answer in a comment section.
int x = 10;
int y = ++x;
int z = 0;
if (y >= 10 | | y <= ++x) {
z = x;
else {
z = x++;
}
System.out.println(z);
What is the result?
A) 12
B) A compile time error occurs.
C) 10
D) 11
⧪ please give your answer in a comment section.
4 Comments
C
ReplyDeleteC
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteD because ( || ) gives true or false so answer is 11
ReplyDelete