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 "); }
}