What is Inner Class In Java?
An inner class in Java is a class defined within another class. It has access to the members (including private ones) of its enclosing class, allowing for more cohesive design. There are several types of inner classes, including non-static inner classes, static nested classes, local classes (defined within a method), and anonymous classes (without a name). Inner classes help in logically grouping classes that are only used in one place and improve encapsulation.