Remove last element from array

This example will show how to remove the last object from an array in java. A similar example shows how to remove the last element from a collection.

Straight up Java

private static final Logger logger = Logger

public void drop_last_element_java() {

    String[] lastElementRemoved = { "one", "two", "three" };

    String[] removedElement = Arrays.copyOf(lastElementRemoved, 2);;

    assertEquals(2, removedElement.length);


[one, two]