Let's look at this step by step and let's begin on line 13.
Line 13: You create a new Integer object with the value 2.
Line 17: You call the method add3 with i.
Line 5: You create a new local variable named val with the value of i, which is 2 (not zero, as you write in the comment!).
Line 7: x += y is the same as x = x + y. So this is val = val + 3, so that val has the value 5 now.
Line 8: You make i refer to a new Integer object with the value 5.
Note that the i inside the add3 method is NOT the same i as in the main method - variables are passed by value in Java. Line 8 has no effect, because the i of the add3 method is immediately thrown away. The output of the program will be 2, the original value of i in the main method.