/*What is the result of attempting to compile and run the program?
a. Prints: 1,3
b. Prints: 2,3
c. Prints: 1,4
d. Prints: 2,4
e. Run-time error
f. Compile-time error
g. None of the above
The answer given is a, my answer is b, since x is static variable it should be incremented in the method m1 and we should get the result 2,3
can we hide the static variable with local variable like above? */
hi the answer is a. 1,3 because there are 2 xs one is static x and other is local x of m .
when we call m(x,y)
and we are printing the values of static x and the variable y of the class.
since it is pass by value; the x and y in the m(x,y) get incremented to 2 and 4.
However the static x and the class variable y remain 1 and 3.