Question: import java.util.ArrayList;public class ArrayListDemo{ public static void main(String[] args) { ArrayList names = new ArrayList(); names.add(Abigail); display(names); names.add(Brian); display(names); names.add(Zachary); display(names); names.add(2, Christy); display(names); names.remove(1);

import java.util.ArrayList;public class ArrayListDemo{ public static void main(String[] args) { ArrayList names = new ArrayList(); names.add("Abigail"); display(names); names.add("Brian"); display(names); names.add("Zachary"); display(names); names.add(2, "Christy"); display(names); names.remove(1); display(names); names.set(0, "Annette"); display(names); } public static void display(ArrayList names) { System.out.println(" The size of the list is " + names.size()); for(int x = 0; x < names.size(); ++x) System.out.println("position " + x + " Name: " + names.get(x)); }}

Re-write this program so that the names of the Seven Dwarfs ( Doc ; Dopey; Bashful; Grumpy; Sneezy;Sleepy; Happy) are used instead of the names in the program. Arrange the names in alphabetical order

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!