i basically have a long array i want to copy to another array object. does this copy by refrence? i know java doesnt do refrences but i read somewhere it would pass by refrence.

char[][][] data=new char[numFiles][][],data1=new char[numFiles][][];
for (int i = 0; i < numFiles; i++) {
data[i]=split(files[i]); //line 1-Reads file into char array
data1[i]=bubbleSort(data[i]);//line 2
}

basically would line 2 affect data?

public static char[][] bubbleSort(char[][] x) {
int n = x.length;
for (int pass=1; pass < n; pass++) {
for (int i=0; i < n-pass; i++) {
if (x[i][0] > x[i+1][0]) {
// exchange elements
char[] temp = x[i];
x[i] = x[i+1];
x[i+1] = temp;
}
}
}
return x;
}

got it... System.arraycopy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.