I have a 2D array called box.
int[][] box = new int [2][3];
Its has elements as follows:
box [0][0] = 1; box [0][1] = 2; box [0][2] = 3; box [1][0] = 1; box [1][1] = 2; box [1][2] = 3;
I want to end up after coding with elements in the array as follows:
i.e All elements in each column has had its valuesbox [0][0] = 2; box [0][1] = 3; box [0][2] = 3; box [1][0] = 2; box [1][1] = 3; box [1][2] = 3;
replaced by values from its immediate right hand column
I have tried :
but no joy. Any thoughts please??for (int j = 0; j < box.length - 1; j++) for (int i = 0; i < box.length - 1; i++) box[i][j] = box[i] [j + 1];