Classes can be nested in other classes.
Nested class can not access the properties of outer class. because its object if created even if we don't create the object of outer class
Note: You can also use interfaces with nesting. All combinations of classes and interfaces are possible: You can nest interfaces in classes, classes in interfaces, and interfaces in interfaces.
A nested class marked as inner can access the members of its outer class. Inner classes carry a reference to an object of an outer class
It can acess the outer class variable. because outer class object is created before doing it
Class declared within a class is called nested class
It exists only if the outer class is exists. it doesn't exist on its own
Nested class's object is created by outer class's name while inner class's object is created by outer class's object not by just a name
Nested class's method can't access outer class's properties while inner class's members can access the properties of outer class
Inner class can use the variable of outer class that is why outer class's object must be created to create the inner class object. then only it is possible for the inner class to access the variable of outer class