Chapter 16 - Exercise 10

(2) Modify ArrayOfGenerics .Java to use containers instead of arrays. Show that you can eliminate the compile-time warnings.




class ArrayOfGenericType<T> {
    List<T> array;
    public ArrayOfGenericType() {
        array = new ArrayList<T>();
    }
}

public class Exercise10{
    public static void main(String[] args){
        ArrayOfGenericType<String> agt=new ArrayOfGenericType<String>();
    }
}



Need Java Developers? Hire Me »

I know Java. Talk is cheap, watch my code.

I live in CANADA now.