Skip to content

Instantly share code, notes, and snippets.

@RainWarrior
Last active August 29, 2015 14:08
Show Gist options
  • Save RainWarrior/5036242f033e24ccde9a to your computer and use it in GitHub Desktop.
Save RainWarrior/5036242f033e24ccde9a to your computer and use it in GitHub Desktop.
interface I {
public int x();
}
class IImpl {
public int y() {
return 3;
}
}
class A implements I {
public int x() {
return 4;
}
}
public class Main {
public static <F,T> T convert(F obj) {
//return (T)(Object)obj;
return null;
}
public static void main(String[] args) {
A a = new A();
//IImpl i = (IImpl)(Object)a;
IImpl i = convert(a);
System.out.println(i.y());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment