> java.lang.Object
> This is true for custom classes. For primitive types such as int.class, void.class and Object itself have no super class.
This is misleading. Primitives (and void) are not classes at all, which is why they do not have a superclass. Interfaces also don't have superclasses for the same reason. These all do have a representation of the type 'java.lang.Class', and they all support the class literal (X.class) expression, but they are not classes. java.lang.Object is still the base class for all classes.
If I had an interviewee throw this stuff at me, I'd consider it a negative. If you're going to be pedantic, you'd better be correct.
As for this:
> Which one is faster in Java ?
> for(int i = 100000; i > 0; i--) {}
> for(int i = 1; i < 100001; i++) {}
> Answer: Which ever is run second with be fastest. The server JVM can detect and eliminate loops which don't do anything...
Will the compiler itself not detect and eliminate these?
Edit: Apparently no, the compiler won't optimize those away. I can't imagine why. Whether the JIT will optimize away the second loop isn't as clear as he indicates, though. Assuming they are in separate methods, optimizing the first away (after it runs) will have no effect on the second.