What will be the result of compiling and running the following code?

public class Test {
    public static void main(String... args) {
        test("A", "B");

    public static void test(String... str) {

    public static void test(String str1, String str2) {

    public static void test(String str1, String... str2) {
Each of the three test() methods is potentially applicable for the call test("A", "B").
Because among them there is only one method with a fixed number of arguments, it is he who will be called.

Follow CodeGalaxy

Mobile Beta

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