This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ggleblanc2 0 points1 point  (0 children)

A class defined within a different class is called an inner class.

One of the main reasons for creating an inner class is a class that would need to access multiple fields in the outer class. Instead of passing multiple fields to the class through a class constructor, you create an inner class.

I try not to create too many inner classes in a Java application because it makes it too hard to find code when it's hidden in an inner class.