This content has been marked as final. Show 5 replies
Wouldn't it be simpler and quicker and more reliable to just try it? The compiler will tell you, with 100% accuracy. You don't need to waste time asking humans about this sort of thing.
Why is it required, you ask?
It isn't required to use an inner class inside an interface. It's entirely optional.
I translate this question as follows: "Can anyone think of a reason why it would be useful to declare an inner class inside an interface?"
If my translation is correct, my answer to it is: No, I can't think of a single reason or application requirement where it would be useful. In fact it surprises me that it is possible, I never even considered to go find out.
I've done it many times. For example, a Factory class. There is also a use case in RMI that's in my book: an abstract base class that implemented the remote interface, in case you had multiple implementations.
gimbal2 wrote:I translate these questions as "I was asked this in an interview".
I translate this question as follows