package com.javarush.task.pro.task05.task0504;
/*
Объединяем массивы
*/
public class Solution {
public static int[] firstArray = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
public static int[] secondArray = new int[]{10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
public static int[] resultArray;
public static void main(String[] args) {
resultArray = new int[firstArray.length + secondArray.length];
//напишите тут ваш код
int q = 0;
for (int a = 0; a < firstArray.length; a++) {
resultArray[a] = firstArray[a];
}
for (int j = resultArray.length - firstArray.length; j < resultArray.length; j++, q++) {
resultArray[j] = secondArray[q];
}
for (int i = 0; i < resultArray.length; i++) {
if (i < 19) {
System.out.print(resultArray[i] + ", ");
} else
System.out.print(resultArray[i]);
}
}
}package com.javarush.task.pro.task05.task0504;
/*
Объединяем массивы
*/
public class Solution {
public static int[] firstArray = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
public static int[] secondArray = new int[]{10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
public static int[] resultArray;
public static void main(String[] args) {
resultArray=new int[firstArray.length + secondArray.length];
//напишите тут ваш код
int q = 0;
for (int i = 0; i < firstArray.length; i++) {
resultArray[i] = firstArray[i];
} // льем первый массив в итог
for (int j = resultArray.length - firstArray.length; j < resultArray.length; j++, q++) {
resultArray[j] = secondArray[q];
}
//льем второй массив
for (int i = 0; i < resultArray.length; i++) {
if (i<19){
System.out.print(resultArray[i] + ", ");
}
else
System.out.print(resultArray[i]);
}
}
}