+ 2

What is the difference between an Inner Class and a Sub-Class?

8th Apr 2016, 6:20 AM
Amir chopdat
Amir chopdat - avatar
3 Answers
+ 6
There are big differences between inner classes and subclasses: inner classes are in the same file, whereas subclasses can be in another file, maybe in another package. You cannot get an instance of an inner class without an instance of the class that contains it. inner classes have the methods they want, whereas subclasses have the methods of their parent class. Subclasses can of course define additional methods, but they'll always have those of their parent.
16th May 2016, 11:55 AM
James Flanders
+ 1
Inner class lies within the same class. while Sub class may may reside as a child class in inheritence
24th Jun 2016, 7:15 AM
Saud Ahmad
Saud Ahmad - avatar
sorry sir can u send me sub class.
5th Jun 2017, 7:09 AM
Meenti Bist
Meenti Bist - avatar