in this post we will discuss about the inner classes in java. so what is inner class and when we should go for inner classes. Sometimes when we declare a class inside another class, such type of class is called…