Inner nested class in java

We can create a class within a class and the inner class can have its own methods and variables.

Class outer{
int i;
int j;
Class inner{
//Inner class can be private,protected,static or non static.
}

if nested class is public we can simply create its object like this please note we first make object of outer class then we create object of inner class like this

Outer outerReference = new Outer();

And then use it to create object of innere class

Outer.Inner reference = outerReference.new InnerClass();

But if our inner class is private we can't use the above methods.