class A {} class B extends A {} def func(A a) { println("A")} def func(B b) { println("B")} A a = new B()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!