I wrote this code and it work as this task insists, but it's not accept as a solution. What's wrong whit my code?
resultArray = (firstArray);
for (int i = 0; i < resultArray.length; i++) {
System.out.print(resultArray[i] + ", ");
}
resultArray = (secondArray);
for ( int a = 0; a < resultArray.length; a++) {
System.out.print(resultArray[a] + ", ");
}
}
}
Attila Ágoston
Level 5
I need help.
Under discussion
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Harshit GargExpert
5 November 2023, 16:23
Rene is correct
0
Rene
1 November 2023, 21:15
You need to combine firstArray and secondArray into resultArray.
resultArray should contain all elements of firstArray AND secondArray.
The content of resultArray at the end should be :
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
In your program the content of resultArray at the end is:
10, 11, 12, 13, 14, 15, 16, 17, 18, 19
If that is any help without giving away the solution.
0
Thomas
7 September 2023, 13:11
When you post a question there is a little checkbox with the label 'attach code' or similar. Tick that and your code will be attached nicely formatted including task requirements. Without that it is not that easy to answer (usually). Here I'm pretty sure Codegym requires all values from first and second arrays to be in the resulting array. They probably not only check the output but the array elements, too.
0