Question: Declare a ArrayList data structure to hold 15 randomly generated integers between 1 and 50 (repetition is allowed). Print the contents of the ArrayList to
Declare a ArrayList data structure to hold 15 randomly generated integers between 1 and 50 (repetition is allowed).
Print the contents of the ArrayList to the screen.
Write a method to sort the ArrayList in Ascending order. The Method will take an ArrayList as a parameter to be sorted. No sorting routine is allowed(i.e. you cannot use Collections.sort. etc.) Call this method in the main method, passing it your original ArrayList
Print the sorted ArrayList to the screen.
Public static void sorting(ArrayList
//code here
}
Public static void main (String[] args) {
//Call above method here, passing in your ArrayList as a parameter
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
