Given the code fragment:
What is the result if the integer aVar is 9?
A.
Compilation fails.
B.
10 Hello Universe!
C.
10 Hello World!
D.
9 Hello World!
Given the code fragment:
What is the result if the integer aVar is 9?
A.
Compilation fails.
B.
10 Hello Universe!
C.
10 Hello World!
D.
9 Hello World!
B
Wrongism, it’s Hello World. Arigato Gozeymas
correct answer is C “10 Hello World!”
I don’t think so bro. It will print 9 hello world first because its post increment
I just did a test and you’re right > its D.
I mean C!!!!!
C
Answer: C
package q035;
public class Test {
public static void main(String[] args) {
int aVar = 9;
if (aVar++ < 10) {
System.out.println(aVar + " Hello World!");
} else {
System.out.println(aVar + " Hello Universe");
}
}
}
Output:
10 Hello World!
C