+ 1
[SOLVED] plz tell me the output of the following
public class Program { public static void main(String[] args) { int num1 = 4; int num2 =8; num2 += ++ num1; System.out.println(num2); } }
6 Answers
+ 11
++num1 increments num1 and returns the result (4 + 1 = 5).
num2 += ++num1 => num2 += 5
num2 += 5 => num2 = num2 + 5 = 8 + 5 = 13
Hence, 13 is printed.
+ 7
13
+ 3
13
+ 1
plz tello
+ 1
thanks
0
thanks