class A { } class B extends A { } public class MainClass { static String s = "-"; public static void main(String[] args) { A[] aa = new A[2]; B[] ba = new B[2]; myMethod(aa); myMethod(ba); myMethod(7); System.out.println(s); } static void myMethod(A[]... a2) { s += "1"; } static void myMethod(B[]... b1) { s += "2"; } static void myMethod(B[] b1) { s += "3"; } static void myMethod(Object o) { s += "4"; } }