Menu
Topics Index
...
`

Creating Interface and its Implementation


If you need explanation Read this topic

If you need Answer Take test on this topic

Creating Interface and its Implementation
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 ");    }
}

A. confuse question clarification chaos ?
B. explain confuse question clarification chaos ?
C. explain question clarification confuse
D. explain confuse question clarification ?
E. Some other output
F. Compilation Error or Runtime Error
Topic: Unknown

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

© meritcampus 2019

All Rights Reserved.

Open In App