While this is obviously a RTFM case, somehow I failed to find a concise source explaining it all.
public class Outer {
private class Inner {
}
}
Private class Inner
is an inner
class of a public class Outer
.
My question is about visibility of Inner
from outside `Outer'.
Should I be able to instantiate
Inner
in another class? If yes, are there any limitations (like this class being in the same package, etc.)?Can
Inner
be used as a concrete type when using collections? For example, should I be able to declareArrayList <Inner>
in another class?If another class
extends Outer
willInner
come along in terms of the above questions?