When your inner class is considered as part of your "object", use inner class.
Indeed, you would be able to access private,package,protected and public fields from your wrapping class.
"Drawback" is: An inner class can't exist without it's wrapping class instantiated, that is logically due to the first sentence.
Otherwise, if you consider:
- The behaviour of your nested(called also static inner) class isn't considered as reusable by external class since maybe too specific.
- some related fields of one class as being so much related that you want to make
a class wrapping them. This will get your code more understandable and cleaner.
then choose to make a static class.
Moreover, since static
(meaning outside the life cycle of any object), a nested class may instantiate without regarding its wrapping class/object.