In the code above inner class needs to access outer class variable to perform certain task.
But why can't we just add a instance variable of Outer class in Inner class and keep both classes separate.Why do we need to nest it.What is the need of Inner Classes in java?