Originally posted by Vidya Ram:
1. Is the nested interface implicitly static (I know its implicitly public and abstract)? If yes, then what's the reason for this?
From the JLS,
§8.1.2 Inner Classes and Enclosing Instances:
Member interfaces (�8.5) are always implicitly static so they are never considered to be inner classes.
As far as "why" this is the case, let's argue the inverse. What good would it be to have a "non-static" nested interface? In which situtation would you want an interface to exist only when a class has been instantiated?
In fact, all Interfaces, whether nested or not are implicity static. They always exist, whether a class that implements them has been instantiated or not.
2. Is the class nested inside an enclosing interface implicitly static (I know its implicitly public)?
Thanks for any help in advance.
Again, referring to the JLS,
§9.5 Member Type Declarations:
Interfaces may contain member type declarations (�8.5). A member type declaration in an interface is implicitly static and public.
So, yup, it's static as well as public.
I hope that helps,
Corey