Menu
Question Index
...

What is the output of the following program?

public class ObjectTest {
    public static void main(String[] args) {
        ObjectTest ob = new ObjectTest();
        ob.myMeth(2, 3.0, "Welcome", "Merit", "Campus");
        String[] s = {"Hai", "Hello"};
        ob.myMeth(4, 5.0, s);
    }
    public void myMeth(int i, float f, String... s) {
        System.out.println(i + " " + f + " " + s.length);
    }
    public void myMeth(int i, float f, String[] s) {
        System.out.println(i + " " + f + " " + s.length);
    }
}


2 3.0 3
4 5.0 2
4 5.0 2
2 3.0 3
Compiles and executes successfully without any output
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Multiple Methods In One Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App