Java Arithmetic Operator Question 1

Question

Assuming that x = 2 and y = 3

What is the output of the following code?

a)   System.out.printf("x = %d%n", x);  
b)   System.out.printf("Value of %d + %d is %d%n", x, x, (x + x));  
c)   System.out.printf("x =");  
d)   System.out.printf("%d = %d%n", (x + y), (y + x));  


x = 2
Value of 2 + 2 is 4
x =5 = 5



PreviousNext

Related