LPU Java Unit 2 Lecture 12 MCQ Overloading RB | LPUCOLAB

LPU Java Unit 2 Lecture 12 MCQ Overloading RB | LPUCOLAB

LPU_Java_Unit 2_Lecture 12_MCQ_Overloading_RB

1. Which of the following statements about function overloading is correct?

Answer:
Function overloading allows methods with the same name but different parameter lists


2. What will be the output of the following Java program?

class Test {
    void display(int a, int b) {
        System.out.println("Method 1");
    }
    void display(double a, double b) {
        System.out.println("Method 2");
    }
    public static void main(String[] args) {
        Test obj = new Test();
        obj.display(10, 10.0);
    }
}

Answer:
Method 2


3. Which of the following is true for constructor overloading?

Answer:
Constructors can be overloaded using different signatures