Question: 3. (15 pts) Find three errors in the following program. Circle the line number of the erroneous Java instructions. Explain the reason of the error

 3. (15 pts) Find three errors in the following program. Circle

3. (15 pts) Find three errors in the following program. Circle the line number of the erroneous Java instructions. Explain the reason of the error right next to the erroneous line. You will not get credit if the reason is not correct. You will get a penalty if you mark a correct one as an error. 1 import java.util.ArrayList; 2 public class Bag { 3 private ArrayList data; private int id; private static int serial_id; public Bag() { data = new ArrayList(); id++; } 9 10 public BagIterator getIterator() { 11 return new BagIterator(); } 12 public static BagIterator getAnotherIterator() { 13 return new BagIterator(); } 14 private class BagIterator { private int count; private static int serial bag_num; public Element next() { 18 return data.get(count++); } 19 } 17 20 private static class Element private int value; private static int serial bag num; public int getValue() { System.out.println("ID of this bag is " + id); serial_bag_num++; return value; 29 )

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!