Why should I use a nested class instead of create a separate One? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why should I use a nested class instead of create a separate One?

21st Apr 2016, 10:11 AM
andrea zube
andrea zube - avatar
2 ответов
+ 3
The purpose is typically just to restrict the scope of the nested class. Nested classes compared to normal classes have the additional possibility of the private modifier.
20th May 2016, 2:27 PM
James Flanders
0
Typically a nested class is only used by its parent class. There are some cases where a nested class is externally accessible but they are semi-rare.
10th Nov 2016, 11:49 PM
Michael Dolence