I need to create an array that holds integers. I did this:
int[] arr;
arr = new int[5];
arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
arr[3] = 40;
arr[4] = 50;
I need to shift the elements to left and set the last one to Null.
for (int i = 0; i < arr.length-1; i++)
arr[i]=arr[i+1];
arr[arr.length-1]= Null
I did the above but I get an error. Please help me, I need to use null, not -1 or any other number. Perhaps I need to change my elements to object of Integer, but I dont know how to. Thanks