public static String[][] deepCopy(String[][]toclone){
String[][]clone = new String[4][4];
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
if(toclone[i][j] != null) {
String s = new String(toclone[i][j]);
clone[i][j] = s;
}
}
}
return clone;
}
I need a deep copy and not just a flat one for my programm..clone() does not work for my problem. Thanks already for your tips and advice.This questions wasnt answered before or atleast not with the question linked with an 2d int array deep copy. That does not help me at all.