Skip to main content

I hope m and n are using pass by values.

Instead try using pass by reference for doing so in java it has to be object in which case instead of declaring it as integer variable make it integer:

m= new Integer();