Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to add to arras java

public int[] addToArray(int[] arr, int item){
  int[] newArr = new int[arr.length + 1];
  for (int i = 0; i < arr.length; i++) {
    newArr[i] = arr[i];
  }
  newArr[newArr.length - 1] = item;
  return newArr;
}
 
PREVIOUS NEXT
Tagged: #add #arras #java
ADD COMMENT
Topic
Name
3+8 =