What will be printed out as a result of the following code execution / compilation?

public class Test {
    static void m(int ... a) {

    static void m(Integer ... a) {

    public static void main(String[] args) {
        m(1, 2);
Both methods m (int ... a), and m (Integer ... a) can be applied for an m (1,2) method call. None of these methods is the most specific one, so there a compiletime error will occur (an ambiguous methods).
PS: Earlier versions of JDK8 contained an error, due to which the given code successfully compiled contrary to specifications.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback