Create an array list with 49 Integer objects containing the numbers 1 through 49. It then randomly shuffles the list and selects the first 6 values from the shuffled list. Finally, it sorts the selected values and prints them out. Hint: Use ArrayList, Collections.shuffle(), ArrayList.subList(), and Collection.sort().


Updated: Nov. 27, 2020 — Training Time: 2 minutes
Overseen by: Archangel Macsika
Topic: Array - Java Programming

Difficulty: Intermediate.

Companies who previously asked this: -.

Objective: Create an array list with 49 Integer objects containing the numbers 1 through 49. It then randomly shuffles the list and selects the first 6 values from the shuffled list. Finally, it sorts the selected values and prints them out. Hint: Use ArrayList, Collections.shuffle(), ArrayList.subList(), and Collection.sort().

Input: Auto generate 49 integers with a loop.

Expected Output: Display randomly selected value already sorted.

Sikademy Solution

Was this training resource helpful?