public int resizeArr(int  b,int n)
z = n;
b = new int;
b = (int)ArrayUtils.expand(b);
Mark Nathon wrote:You can call a method by value or by reference.
So, any modification to the array elements in another function would mean that the original array would also be modified similarly.
I see Stephan has already explained your mistake. Thank you for giving us that link It is unfortunate that people still write that sort of rubbish in tutorials.
Mark Nathon wrote:. . . You can call a method by value or by reference. . . . Java always passes arrays and vectors by reference. . . .
I brought this back from the farm where they grow the tiny ads:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earthhttps://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter