Inner Classes It allows you to group classes that logically belong together and to control the visibility of one within the other. It knows about and can communicate with the surrounding class. Creating inner classes You place the class definition in…