The size of arrays in Java cannot be changed. So, technically you cannot remove any elements from the array.

One way to simulate removing an element from the array is to create a new, smaller array, and then copy all of the elements from the original array into the new, smaller array.

String[] yourArray = Arrays.copyOfRange(oldArr, 1, oldArr.length);

However, I would not suggest the above method. You should really be using a List<String>. Lists allow you to add and remove items from any index. That would look similar to the following:

List<String> list = new ArrayList<String>(); // or LinkedList<String>();
list.add("Stuff");
// add lots of stuff
list.remove(0); // removes the first item
Answer from jjnguy on Stack Overflow
🌐
Baeldung
baeldung.com › home › java › java collections › remove the first element from a list
Remove the First Element from a List | Baeldung
January 8, 2024 - Hence, removing the first element means just changing the pointer to the first element. This operation always requires the same time not depending on the size of a list.
Top answer
1 of 7
195

The size of arrays in Java cannot be changed. So, technically you cannot remove any elements from the array.

One way to simulate removing an element from the array is to create a new, smaller array, and then copy all of the elements from the original array into the new, smaller array.

String[] yourArray = Arrays.copyOfRange(oldArr, 1, oldArr.length);

However, I would not suggest the above method. You should really be using a List<String>. Lists allow you to add and remove items from any index. That would look similar to the following:

List<String> list = new ArrayList<String>(); // or LinkedList<String>();
list.add("Stuff");
// add lots of stuff
list.remove(0); // removes the first item
2 of 7
16

Simplest way is probably as follows - you basically need to construct a new array that is one element smaller, then copy the elements you want to keep to the right positions.

int n=oldArray.length-1;
String[] newArray=new String[n];
System.arraycopy(oldArray,1,newArray,0,n);

Note that if you find yourself doing this kind of operation frequently, it could be a sign that you should actually be using a different kind of data structure, e.g. a linked list. Constructing a new array every time is an O(n) operation, which could get expensive if your array is large. A linked list would give you O(1) removal of the first element.

An alternative idea is not to remove the first item at all, but just increment an integer that points to the first index that is in use. Users of the array will need to take this offset into account, but this can be an efficient approach. The Java String class actually uses this method internally when creating substrings.

🌐
GeeksforGeeks
geeksforgeeks.org › java › remove-first-element-from-arraylist-in-java
Remove first element from ArrayList in Java - GeeksforGeeks
July 12, 2025 - We can pass the first element's index to the remove() method to delete the first element. Index of elements in an ArrayList starts from zero. Therefore, index of first element in an ArrayList is 0. ... // Java program to delete the first // ...
🌐
GeeksforGeeks
geeksforgeeks.org › java › linkedlist-removefirst-method-in-java
LinkedList removeFirst() Method in Java - GeeksforGeeks
July 11, 2025 - Example 1: Here, we use the removeFirst() method to remove the first element (head) of the LinkedList of Integers. ... // Java Program to demonstrate the // use of removeFirst() in LinkedList import java.util.LinkedList; class Geeks { public ...
🌐
W3Schools
w3schools.com › java › ref_linkedlist_removefirst.asp
Java LinkedList removeFirst() Method
import java.util.LinkedList; public class Main { public static void main(String[] args) { LinkedList<String> cars = new LinkedList<String>(); cars.add("Volvo"); cars.add("BMW"); cars.add("Ford"); cars.add("Mazda"); // Use removeFirst() remove ...
🌐
How to do in Java
howtodoinjava.com › home › collections framework › java arraylist › java arraylist remove(): remove a single element from list
Java ArrayList remove(): Remove a Single Element from List with Examples - HowToDoInJava
August 7, 2023 - ArrayList remove() removes the first occurrence of the specified element from this list, if it is present, else the list remains unchanged. ... Java ArrayList.remove() method removes the first occurrence of the specified element from this arraylist ...
🌐
w3resource
w3resource.com › java-exercises › collection › java-collection-linked-list-exercise-19.php
Java - Remove and return the first element of a linked list
import java.util.*; public class Exercise19 { public static void main(String[] args) { // create an empty linked list LinkedList <String> c1 = new LinkedList <String> (); c1.add("Red"); c1.add("Green"); c1.add("Black"); c1.add("White"); c1.add("Pink"); System.out.println("Original linked list: " + c1); System.out.println("Removed element: "+c1.pop()); System.out.println("Linked list after pop operation: "+c1); } }
🌐
Baeldung
baeldung.com › home › java › java array › removing the first element of an array
Removing the First Element of an Array | Baeldung
April 22, 2025 - First of all, removing an element of an array isn’t technically possible in Java.
Find elsewhere
🌐
W3Resource
w3resource.com › java-tutorial › arraylist › arraylist_remove-first-occurrence.php
Java remove first character from arraylist Method - w3resource
Java ArrayList.remove(Object o)() Method: This method is used to remove the first occurrence of the specified element from this list, if it is present. If the element is not present within the list, it is unchanged.
🌐
Reactgo
reactgo.com › home › how to remove the first element of an arraylist in java
How to remove the first element of an ArrayList in Java | Reactgo
August 15, 2021 - In this tutorial, we are going to learn about how to remove the first element of an ArrayList in Java. ... To remove the first element of a ArrayList, we can use the list.remove() method by passing its index 0 as an argument to it.
🌐
Quora
quora.com › How-do-you-remove-the-first-and-last-elements-from-a-Java-List
How to remove the first and last elements from a Java List - Quora
Answer (1 of 2): You’re not specifying the list type to be used. The most efficient way to remove the head and tail nodes of a list depends on the concrete list. The general solution (ignoring bound checks for now) is to do the following: [code]List list = ...; list.remove(0); list.remov...
🌐
Java Guides
javaguides.net › 2024 › 06 › java-arraylist-removefirst-method.html
Java ArrayList removeFirst() Method
June 11, 2024 - The ArrayList.removeFirst() method is part of the ArrayList class in Java 21. It allows you to remove the first element of the list directly, simplifying the process of removing the first element without needing to handle the index manually.
🌐
TutorialsPoint
tutorialspoint.com › java › util › linkedlist_removefirst.htm
Java LinkedList removeFirst() Method
The Java LinkedList removeFirst() method retrieves and removes the first element of this linkedList.
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-list-remove-methods-arraylist-remove
How To Use remove() Methods for Java List and ArrayList | DigitalOcean
September 9, 2025 - The remove(int) method removes the element at the specified index, while the remove(Object) method removes the first occurrence of the specified element. If the element is not found in the list, the remove(Object) method does not modify the list and returns false.
🌐
TutorialKart
tutorialkart.com › java › java-remove-first-element-of-array
Remove First Element of Array in Java
October 16, 2021 - In the following example, we create a new array with the first element removed from the original array using Array.copyOfRange() method. ... import java.util.Arrays; public class Main { public static void main(String[] args) { int arr[] = {2, ...
🌐
w3resource
w3resource.com › java-exercises › collection › java-collection-linked-list-exercise-13.php
Java - Remove first and last element from a linked list
import java.util.*; public class ... " + l_list); // Remove the first element Object firstElement = l_list.removeFirst(); System.out.println("Element removed: "+ firstElement); // Remove the last element Object lastElement = ...
🌐
BeginnersBook
beginnersbook.com › 2014 › 07 › java-remove-first-and-last-element-from-linkedlist-example
Java – Remove first and last element from LinkedList example
September 11, 2022 - 1) public E removeFirst(): Removes and returns the first element from this list. 2) public E removeLast(): Removes and returns the last element from this list. Complete Code: import java.util.LinkedList; public class RemoveExample { public static void main(String[] args) { // Create a LinkedList ...