0
Explain the code
int i= 5, j=2; for(; i--> ++j; ); System.out.println(i+""+j);
2 odpowiedzi
+ 2
for first iteration i=4,j=3(true), second iteration i=3,j=4(false)
+ 1
Karthik Reddy Thotamgari
For first iteration (5 > 3) //true
Now i = 4, j = 3 for 2nd iteration after 1st iteration
For 2nd iteration (4 > 4) //false,
Note :- why 4 > 4 because i++ is post increment and ++j is pre increment
Iteration will stop here because of false but after 2nd iteration the value of i and j will be
i = 3, j = 4