how to use inner class and where please give an example | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

how to use inner class and where please give an example

12th Mar 2017, 7:50 AM
Roshan Kumar
Roshan Kumar - avatar
1 Réponse
+ 1
public class SuperC{ int x; int y; protected class InnerClass{ public void increment(int num) { return ++num; } } here you have an inner class encapsulated inside a class, only this class and his inheritances can access this inner class. that can help you if you want "hide" methods from another classes
12th Mar 2017, 6:21 PM
Oriel
Oriel - avatar