import java.util.Arrays; public class Demo { public static void main(String[] argv) throws Exception { int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 }; System.out.println("Initial array...\n"+Arrays.toString(arr)); System.arraycopy(arr, 1, arr, 0, arr.length - 1); System.out.println("Array after shifting to the left..."); System.out.println(Arrays.toString(arr)); } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more