Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
An inner class is a good way to hide data and mechanism (encapsulation). You would want to make inner class if the class you need is only connected with that certain class that will use it and has no other meaning in the context of any other class. Iterators are implemented as inner classes.
3rd Mar 2017, 7:18 PM
Ladislav Milunović
Ladislav Milunović - avatar