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. . . .
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton