If you need to implement an interface as part of your business logic, but do not want it to be publicly available as part of your class, inner classes allow you to do this.
In general, since Java requires objects for everything, they are often quite useful for things like listeners in user interface programming, where you need to listen for a bunch of buttons or other inputs, you can add an anonymous inner class for each of them instead of putting a lot if then elses between one listener implementation for buttons or something else.
And no, you do not need to use them for anything.
source share