Remove First Element from Array using Java

Arrays.copyOfRange method

package app;

import java.util.Arrays;

public class Main
{
    public static void main(String[] args)
    {
        Integer[] data = {10, 3, 17, 50, 15};
        data = Arrays.copyOfRange(data, 1, data.length);

        System.out.println(Arrays.toString(data));
    }
}

Leave a Comment

Cancel reply

Your email address will not be published.