Bounded Types2865 - 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.sayHello();
        obj.print();
    }
}
class Wishes extends Hello implements Hi
{
    public void print() {
        System.out.print("Hi");
    }
}
interface Hi
{
    void print();
}

class Hello
{
    void sayHello()
    {
        System.out.print("Hello   ");
    }
}


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