Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to take an element out of an array at a certain index in java

 for (int i = 0, k = 0; i < arr.length; i++) {
 
            // if the index is
            // the removal element index
            if (i == index) {
                continue;
            }
            // if the index is not
            // the removal element index
            anotherArray[k++] = arr[i];
        }
        // return the resultant array
        return anotherArray;
 
PREVIOUS NEXT
Tagged: #element #array #index #java
ADD COMMENT
Topic
Name
8+5 =