class MAIN { public static void main (String[] args) { System.out.println((new A()).getThis()); System.out.println((new B()).getThis()); }}class A { public<T extends A> T getThis() { return this; }}class B extends A {}
Standard input is empty
Main.java:9: error: incompatible types return this; ^ required: T found: A where T is a type-variable: T extends A declared in method <T>getThis() 1 error
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!