// Example 120 from page 91 of Java Precisely second edition (The MIT Press 2005) // Author: Peter Sestoft (sestoft@itu.dk) import java.util.*; class G { } class Example120 { public static void main(String[] args) { new F().M(); } } class F { public void M() { T[] tarr; // Legal declaration G[] ctarr; // Legal declaration G[] ciarr; // Legal declaration // tarr = new T[5]; // Illegal generic array creation // ctarr = new G[5]; // Illegal generic array creation // ciarr = new G[5]; // Illegal generic array creation ArrayList tlist; // Legal declaration ArrayList> ctlist; // Legal declaration ArrayList> cilist; // Legal declaration tlist = new ArrayList(); // Legal arraylist creation ctlist = new ArrayList>(); // Legal arraylist creation cilist = new ArrayList>(); // Legal arraylist creation } }