In Java, you can nest classes within other classes. This feature is very useful when you need it,
but it can be easily abused.

When you have a choice, you should declare your nested classes as static.
The reason is that non-static nested classes (inner classes) are tightly coupled to the enclosing parent,
while static nested classes aren't.
This extra coupling can sometimes cause problems.
In general, static nested classes are safer than non-static ones, and less prone to error.

Secondly, you should very rarely use deep levels of nesting.

The terminology for nested classes is a bit confusing.
Here's a reminder of the hierarchy:

nested class
staticinner class (non-static)
regular, not within a method or constructor
inside a method or constructor
anonymouslocal

Some more reminders:

static - not tied to a parent instance (but can see the private fields of a parent, if it
has an object reference)

non-static (inner class) - always tied to a parent instance

anonymous - no access modifiers; no extends or implements; no constructor

local - never static; no access modifiers; can access only final items that are in scope; this is
the rarest form of nested class.

Here's a class which sketches all the different types of nested class: