Fri Oct 24, 2008 6:15 pm
Fri Oct 24, 2008 6:16 pm
public class M {
public static <T extends A> int g (T x) {return T.f ();} public
static <T extends B> int g (T x) {return T.f ();}
}
class A { public static int f() { return 28; } }
class B extends A { public static int f() { return 42; } }
public class testABC {
public static void main(String[] args) {
A alpha= new A ();
B beta = new B ();
M m = new M ();
int retA = m.g (alpha);
int retB = m.g (beta);
System.out.print(retA);
System.out.print(retB);
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.