+ 1
Can someone explain the program, I don't understand why the output is 326
What is the output of this code? int x = 21; int y = 7; System.out.print(x- - /y- -); System.out.print(x+y) ; output: 326
5 odpowiedzi
+ 7
first print -> 21/7 = 3 (no change in values due to post decrement operator)
second print -> 20+6 = 26 (decremeted values due to previous line)
output => 326 (append both values)
+ 2
thankyouu!!! I finally understand hehehe
+ 1
Infinity in second print, how did it became 20 and 6? why it is not the original value?
+ 1
x-- in first print actually decreased the value of x and so did y-- to y
+ 1
For clarity, post decrement operator is like - use now, decrement later