Filling an array

  • 6
  • Locked
Implement a static main(String[]) method that populates the array variable with the values valueStart and valueEnd. If the length of the array is even, then its first half must be filled with valueStart values, and the second half with valueEnd. If the length of the array is odd, then fill the large
You can't complete this task, because you're not signed in.
Comments (4)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Ace Phelps
Level 9 , United States of America, United States
30 April, 07:36
idk whats going on but heres my code what did i do wrong i dont get it if (array.length % 2 == 0) { Arrays.fill(array, 0, array.length/2, 10); Arrays.fill(array, array.length/2, array.length, 13); System.out.println(Arrays.toString(array)); } if (array.length % 2 != 0) { Arrays.fill(array, 0, array.length, 13); Arrays.fill(array, array.length/2, array.length, 10); System.out.println(Arrays.toString(array)); }
Ace Phelps
Level 9 , United States of America, United States
30 April, 07:36
Error: Implement the main(String[]) method in accordance with the task conditions.
Ace Phelps
Level 9 , United States of America, United States
30 April, 07:50
ok i was confused by second step about larger part now i got it (larger part is more then half)
Lisa
Level 41
9 January, 09:22
I do not know the task and I can not open its description. If you're looking for answers the best way is, to attach your existing code. That way everyone can read the task description and what you came up with so far.