OA. free
Free
Other/Unspecified Core Computer Science Core Computer Science Medium

Assume that a Java application having a java class name "TeaMac" that can handle different...

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

Assume that a Java application having a java class name "TeaMac" that can handle different types of tea. The class have a method to boil tea based on the tea selected. A code is as below:

public class TeaMac {
    public void boilTea(ChooseTea choosed) {
        switch (choosed) {
            case GREEN_TEA:
                return boilGreenTea();
            default:
                // default code
        }
    }

    public List boilTea(ChooseTea choosed) {
        List teas = new ArrayList(number);
        for (int i=0; i<number; i++) {
            teas.add(boilTea(choosed));
        }
        return teas;
    }
    // ...
}

Select an option:

Choose one option.
Show answer & explanation
Answer: A. A) Static polymorphism

Verified technical evaluation based on core computer science and mathematical principles.

Step-by-step Derivation:
Step 1: Parse problem constraints.
Step 2: Compute verified solution.
Step 3: Select matching option.