here is the code i have written so far:
static public void addStringElement(String[] arr, int pos, String name){
String[] copy = new String[arr.length+1];
for (int index = 0; index < arr.length+1; index++){
if (index == pos){
copy[index] = name;
}else{
copy[index] = arr[index-1];
}
}
arr = copy;
}
all its doing is returning the exact array that i had in the first place. without the new element added.

New Topic/Question
Reply




MultiQuote






|