String[] petsCopy = pets;
String[] petsCopy = new String[pets.length];
for (int i = 0; i < pets.length; i++) {
petsCopy[i] = pets[i];
}
String[] petsCopy = Arrays.copyOf(pets, pets.length);
int[] temp = new int[arr.length + 1];
System.arraycopy(arr, 0, temp, 0, arr.length);
temp[temp.length - 1] = newElement;
arr = temp;
int delTarget = arr[arr.length - 1];
int[] temp = new int[arr.length - 1];
for (int i = 0; i < temp.length; i++) temp[i] = arr[i];
arr = temp;
for (int i = idx; i < arr.length - 1; i++) {
arr[i] = arr[i + 1];
}
arr = Arrays.copyOf(arr, arr.length - 1);
int[] temp = new int[arr.length + 1];
for (int i = 0; i < idx; i++) temp[i] = arr[i];
for (int i = arr.length; i > idx; i--) temp[i] = arr[i - 1];
temp[idx] = newData;
arr = temp;
for (int i = 0; i < arr.length; i++) {
if (arr[i].equals(target)) { ... }
}
int[][] matrix = {
{10, 20, 30},
{40, 50, 60}
};
for (int[] row : matrix) {
for (int col : row) System.out.print(col + " ");
}
✅ 총정리