Bounded Types2867 - Java Quiz Question


What will be the output of the following program?

public class BoundedTypeDemo4 {
    
    public static void main(String args[])
    {
        BoundedType4<Wishes> obj = new BoundedType4<Wishes>(new Wishes());
        obj.print();
    }
}
class BoundedType4 <T extends Hi & Hello>
{

    T obj;
    BoundedType4(T obj)
    {
        this.obj = obj;
    }
    void print()
    {
        obj.print();
        obj.sayHello();
    }
}
class Wishes implements Hello, Hi
{
    public void print() {
        System.out.print("Hi...");
    }
    public void sayHello() {
        System.out.print("Hello...");
    }
}
interface Hi
{
    void print();
}

interface Hello
{
    void sayHello();
}


A
Hello...Hi...
B
Hi...Hello...
C
Hi...
D
Compilation Error
E
Runtime Error