Would it be considered a bad practice to nest a private static class inside of a non-static class?
public class Outer
{
private static class Inner
{
}
}
The idea here is that all instances of 'Outer' would share access to the static state. Another way to do it might be to just let the Inner class be non-static and use a static instance of it:
public class Outer
{
private static innerInstance = new Inner();
private class Inner
{
}
}
Similar effect. What are the pros / cons or other considerations with this approach?
I must admit that I almost never use nested classes, whether static or not, but I am interested in this particular concept..
Node
in Linkedlist.java is static. Look up on effective java – Odilo