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

0 votes
303 views
Anonymous User asked 19-Dec-2017 in Technology by Anonymous User

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

1 Answer

0 votes
Harsh kumar srivastava answered 19-Dec-2017 by Harsh kumar srivastava
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.
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.