"Hi, Amigo. Here are some interesting tasks involving static methods:"
6
Task
New Java Syntax,
level 6,
lesson 8
Locked
Filling an array
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
6
Task
New Java Syntax,
level 6,
lesson 8
Locked
Splitting an array
Implement the main(String[]) method, which splits an array into two subarrays and fills a two-dimensional result array with them.
If the length of the array is odd, then the larger half should be copied into the first subarray.
Use the Arrays.copyOfRange(int[], int, int) method to split the array. D
6
Task
New Java Syntax,
level 6,
lesson 8
Locked
Sorting an array
Implement the main(String[]) method, which sorts array in ascending order.
Use the Arrays.sort(int[]) method to sort the array.
6
Task
New Java Syntax,
level 6,
lesson 8
Locked
Is anyone there?
Implement the main(String[]) method, which displays true if the element is contained in the passed array, otherwise false.
The array variable should not change the position of its elements.
To search for an element in an array, you need a binary search. To do this, use the static Arrays.binarySearc
GO TO FULL VERSION