Thank you for this video! In 13 mins you managed to help me understand shifting elems in array better than in 1 hour of my "Java course" :) Thanks for your work!
Thank you so much, i totally understand your explanation! I was trying to do something similar but i thought i could do it with incrementing i. Could you help me understand what I am missing in the following code? public static void rotateGroceries(String[] groceryList) { if(groceryList.length>1){ String lastElement = groceryList[groceryList.length-1]; for(int i = 0; i< groceryList.length-1; i++){ if(i==0){ groceryList[i] = lastElement; }else{ groceryList[i] = groceryList[i+1]; } } In my output, the last element seems to take over most of the positions but I don t really understand why