0
why output is 35 i guess it should be 34 once visit my code
public class Program { public static void main(String[] args) { int x = 34; int y = x++; System.out.println(x); } }// my ans is 35
2 Réponses
+ 1
because incremental operation modifie always the initial variable
0
This is called post increment. The value is first assigned and then incremented. Print y and it will give 34 where as x has become 35.