I have a class MyClass
and an inner class MyNestedClass
like this:
public class MyClass {
...
public class MyNestedClass {
Objects of inner classes keep implicit references to the objects of the paren class.
If the nested class is not static
(it is inner) you can not. But if the nested class does not need access to the parent's class instances directly and does not need access to the private fields, than should be ok to refactor, move the inner class out and do not declare it public (out of that package can not be accessed).