Originally posted by Jayashree Mohan:
I am not able to understand why???
In the first program, the method parameters to the "swapping" method have the same names as the member variables, but you use "this" to disambiguate the two. In the second program, there's only one parameter, and it has the same name as one member variable, but you don't use the class name to disambiguate, so while Test2.i2 gets reassigned, Test2.i1 does
not. See?