Output is correct
++a increments and then uses the variable.
a++ uses and then increments the variable.
so here in t1.j is printed and later incremented
so here in t2.i is printed and later decremented
If you want it to increment and decrement then do below
System.out.print(++t1.j + " " + --t2.i);
Console:
6 4
[quote="ahkbly@gmail.com":1x99kjvv]Output is correct
++a increments and then uses the variable.
a++ uses and then increments the variable.
so here in t1.j is printed and later incremented
so here in t2.i is printed and later decremented
If you want it to increment and decrement then do below
System.out.print(++t1.j + " " + --t2.i);
Console:
6 4[/quote:1x99kjvv]
Wow Thanks for that