Question: Please, I need help doing this in Java. 1. Describe auto-boxing, including why it is useful. (Google for this one) Write a few lines of

Please, I need help doing this in Java.

1. Describe auto-boxing, including why it is useful. (Google for this one) Write a few lines of code that auto-box an int into an Integer, and un-box an Integer to an int.

2. Declare an ArrayList of Strings. Add 5 names to the collection. "Bob" "Susan" ... Output the Strings onto the console using the enhanced for loop.

3. Sort the list using the method Collections.sort. Output the sorted List. Shuffle the list, and output the shuffled list. Note that Collections (with an s) is a class, while Collection is an interface. The Collections class has many useful static methods for processing interfaces, including the sort method.

4. Search for the name "Susan" in the list. What location was it found? Search for a name that is not in the list. What location is reported?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!