Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

DeBug this Java program import java.util.*; public class BattleList { public sta

ID: 638270 • Letter: D

Question

DeBug this Java program

import java.util.*;

public class BattleList {

public static void main(String args[]) {

// Creating an empty array list

//

ArrayList<String> battles = new ArrayList<String>();

// Add battles to the newly-created arraylist:

//

battles.add("April 12, Battle of Fort Sumter");

battles.add("June 3, Battle of Philippi");

battles.add("June 10, Big Bethel");

battles.add("July 21, First Battle of Bull Run");

battles.add("October 9, Battle of Santa Rosa Island");

battles.add("November 7

Explanation / Answer

import java.util.*;

/* The Code is fine. only mistake is just iteration of the ArrayList which i have updated*/
class BattleList {
   public static void main(String args[]) {
       ArrayList<String> battles = new ArrayList<String>();
       battles.add("April 12, Battle of Fort Sumter");
       battles.add("June 3, Battle of Philippi");
       battles.add("June 10, Big Bethel");
       battles.add("July 21, First Battle of Bull Run");
       battles.add("October 9, Battle of Santa Rosa Island");
       battles.add("November 7

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote