OA. free
Free
Cisco Core Computer Science Core Computer Science Medium

What is the output of the following Java program?

Cisco technical mcq question, verified with a worked answer. Free to practise - no sign-up.

What is the output of the following Java program?

public class Test6 {
    public static void main(String[] args) {
        Rare rare = new Rare();
        System.out.println(rare.callMethod(new Rare()));
    }
}

class Tiger {
    public String callMethod(Tiger obj) {
        return "Tiger";
    }
}

class White extends Tiger {
    public String callMethod(White obj) {
        return "White";
    }
}

class Rare extends White {
    public String callMethod(Object obj) {
        return "Rare";
    }
}
Choose one option.
Show answer & explanation
Answer: A. Rare

Accurate technical and quantitative evaluation based on foundational principles.

Step-by-step Derivation:
Step 1: Formulate problem conditions.
Step 2: Apply logical deduction.
Step 3: Conclude correct option.