I am trying to create a random number to add to an array (arr). I have looked around for answers but they all seem to not be working or be outdated. Here is what I have tried:
int[] arr = {};
int rand = (int) Math.round(Math.random() * 100);
arr = append(arr, rand);
However, this doesn't seem to work as there is a red line under append saying "The method append(int[], int) is undefined for the type new ActionListener(){}". Help would be highly appreciated!
ArrayListinstead. You can't change the size of the array once you have created it.