
class A{ public static void main(String[]args){ int i=2,k; k=i++ + ++i + +i; System.out.println(k+" "+i); } }

answer should be i =4 , k = 10
first know the difference between post increment and pre increment. if u dont know,pls refer the google.
Below i mentioned the reason.
it must evaluate right to left.
according to yr code + i == this one wont execute first. because left side variable or value not available. (for ex a+ i or 5+i) so its move next and execute ++i , then it calculate 3 after that i++ should work, that value is also 3. then add the 3+3 +4 = 10.
I hope u understood what i am trying to say. if not plz let me know.