See More

import java.util.* ; class C1 {} interface I1 {} interface I2 {} class noBounds { } class singleBound { } /* There seems to be a bug in GJ compiler not recognizing implments clause... class multipleBounds{ public int foo( A obj ) { return obj.methodA() ; } } */ class Cell { A value ; Cell ( A v ) { value = v ; } A get() { return value ; } void set( A v ) { value = v ; } } // Run Some Misc. Test Cases class GenericJava { public static void main( String[] args ) { // all parameterized types share same run-time class Vector x = new Vector() ; Vector y = new Vector() ; System.out.println( "Parameterized types share same run-time class: " + (x.getClass() == x.getClass()) ) ; // true // Uncheck Warnings Cell x1 = new Cell("abc") ; System.out.println( x1.value ) ; System.out.println( x1.get() ) ; x1.set( "def" ) ; // Warning. Erasure changed argument type to Object /* GenericJava.java:42: warning: unchecked call to set(A) as a member of the raw type Cell x1.set( "def" ) ; */ } }