Inner classes have the methods they want, whereas sub-classes have the methods of their parent class. And Sub-classes can, of course, define additional methods, but they'll always have those of their parent.
What is the difference between an Inner Class and a Sub-Class?
Asked
7 years ago
Viewed
1506 times
What is the difference between an Inner Class and a Sub-Class?
1 Answer
The main difference between inner class and subclass is, An Sub-Class is a class which inherits all the non-private members of its parent Class. But an inner class is a class which is nested within another class, which rights for the class which is nesting it and it can access all variables and methods defined in the outer class.