Question: Consider the attached class. Convert the Alist class into a generic class called GList. import java.util.*, public class AList { private ArrayList aa; public Alist()

 Consider the attached class. Convert the Alist class into a generic

class called GList. import java.util.*, public class AList { private ArrayList aa;

Consider the attached class. Convert the Alist class into a generic class called GList. import java.util.*, public class AList { private ArrayList aa; public Alist() { aa = new ArrayList(); } public void append(Object item) { aa.add(item); } public Object get(int index) { return aa.get(index); } public Object[] toArray() { return aa.toArray(); } } Consider the attached class. Given the following code using the AList and GList classes, point out whether each statement is CORRECT OR INCORRECT (assumed that all the ones prior to it are correct). Write either CORRECT or INCORRECT next to each statement. public static void main(String[args) AList al = new AList(); GList gl = new GList(); String str = "Hello CSC10165": al.append(str); gl.append(str); String out_str1 = al.get(0); String out_str2 = gl.get(0); gl.append(new Double(20))

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!