Hi, In the below mentioned code, value of x and y is printed as 3 and 7. I have a doubt, as I understand scope of variable used in the method is only till the method exists. Once the method is finished variable used in method will also not exist. Why in this case method variable is overwritting the class variable?
david john wrote:... I have a doubt, as I understand scope of variable used in the method is only till the method exists. Once the method is finished variable used in method will also not exist...
You yourself have answered it When you are printing the x and y in the main method, its the local variables not the other ones.
david john
Greenhorn
Joined: Oct 16, 2008
Posts: 16
posted
0
Silly of me.... Did not see that... thanks a lot...