What will be the result of compilation and execution of the following code?

import java.util.*;
public class Test {        
    void a1(Object... i){
        System.out.println("[Object... i]");
    }
    void a1(Integer... i){
        System.out.println("[Integer... i]");;
    }
    public static void main(String... args){
        a1(new Integer[19]);
    }
}
Explanation
Both versions of overloaded method a1 are not static, therefore compilation will fail.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes