Menu
Question Index
...

What will be the output of the following program?

public class ConfusedInterfaces {
    public static void main(String queries[]) throws Clarification, Question {
        Clarify cl = new Clarify();
        Confusion cf = new Explain();
        try {
            cf.confuse();
            cf = (Confusion) cl;
        } catch (Exception e) {
            System.out.print("chaos ");
        }
        System.out.println((char) cf.question());
    }
    void ConfusedInterfaces() {    System.out.println("explain ");    }
}
interface Confusion {
    void confuse() throws Question, Doubt;
    int question() throws Clarification, Question;
}
class Clarify {
    static {    System.out.print("confuse ");    }
    public void confuse() throws Question {    throw new Clarification();    }
}
class Explain extends Clarify implements Confusion {
    public int question() throws Doubt {    return '?';    }
}
class Question extends Exception {
    static {    System.out.print("question ");    }
}
class Doubt extends Question {    }
class Clarification extends Question {
    static {    System.out.print("clarification ");    }
}


confuse question clarification chaos ?
explain confuse question clarification chaos ?
explain question clarification confuse
explain confuse question clarification ?
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Unknown

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App