using System; using System.Collections.Generic; class AA { public T[] H; public AA(int n) { H = new T[n];} // not valid in Java (difficult to explain) public void print() {foreach (T x in H) Console.WriteLine(x);} } public class covariance { public static void Main() { object x = "abc"; // OK object[] A = new string[10]; // legal? yes //A[1] = 3.14; // runtime error //List B = new List(); // compiler error List C = new List(10); C.Add(5); C.Add(6); C[0]= 4; foreach(int n in C) Console.WriteLine(n); AA D = new AA(5); D.print(); }//main }