class A {}class B extends A {}class C extends B {} def func(A a) { println("A")} def func(B b) { println("B")} A a = new C()func(a)
Standard input is empty
B
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!