Without further ado, what will be the output of the following program:
1 class ClassClass {
2 public static void main(String... args) {
3 System.out.println("Is Object.class instanceof Object?: " + Object.class instanceof Object);
4 System.out.println("Is Object.class instanceof Class?: " + Object.class instanceof Class);
5 }
6 }
Of course, I don't know if it is original or not. But I ran into it myself and thought of making it a puzzler :). Here are the options:
- Is Object.class instanceof Object?: false
Is Object.class instanceof Class?: true - Is Object.class instanceof Object?: true
Is Object.class instanceof Class?: true - Compiler error on line number 4
- Compiler error on both lines: 3 and 4
See first comment for answers.