How to delete array element in Java?

To remove an element from an array in Java, first convert it to an ArrayList, then call list.remove(index), finally convert back to an array.

Here's how you do it:

var array = new String[] { "One", "Two", "Three" };

var list = new java.util.ArrayList<String>(java.util.Arrays.asList(array));
list.remove(1);
var newArray = list.toArray(new String[0]);

// [One, Three]
System.out.println(java.util.Arrays.toString(newArray));