hi Sridhar,
ans is 10 and 40.
Let me make this clear to u.
The thumb rule is tht in java , always variables are passed by value. at line 6, u r invoking the method amethod() by passing i as argument to amethod().
as already pointed out, since variables r passed by value, any changes made to i inside amethod() will never effect the actual value of i, since only a copy of i is passed as argument to amethod() but not i.
so, value of iat line 7 is 10 only.
in amethod() u r modifying value of j.Notice tht j is not passed to the method. so, any changes made to j inside amethod() will effect the actual value of j.
So, value of j at line 8 will be 40.
Hope u got it.
Vineela
[ February 22, 2004: Message edited by: Vineela Devi Jakka ]