Good evening everyone , I am curently having problem since i want to make a basic program which basically reverse all the numbers of a certain array into the same array , by that i mean i want to overwrite my array into a new one but with it's number changed. I am still a basic programmer so sorry for not understanding my problem thank you.
public class Reverse { public static void main(String[] args) { int [] numbers = {1,2,3,4,5,6,7,8,9}; reverseInPlace(numbers); } public static void reverseInPlace(int[] a) { a = new int[10]; for (int i = 0; i <= a.length / 2; i++) { int temp = a[i]; a[i] = a[a.length - 1 - i]; a[a.length-1-i]=temp; } } }