public class MainClass extends BaseClass { public static void main(String[] args) { new MainClass().go(); } void go() { go2(new BaseClass(), new MainClass()); go2((MainClass) new BaseClass(), new MainClass()); } void go2(BaseClass t1, MainClass r1) { MainClass r2 = (MainClass) t1; BaseClass t2 = (BaseClass) r1; } } class BaseClass { }