Inner Class & Sub Class Homework Help
Difference between Inner Class & Sub Class
The exactly same files are inner classes having their own methods. It uses has – a relationship. It can be access through the instance of the class that have inner class instance.
The class that contains inner class are called outer class. It is used as a supporting class when a very complex class needs a small class therefore they used inner class and performs operations through it. You can also called inner class a nested class.
Anonymous Inner Class:
A class that has no outer class and can be instantiate and declare at the same time is called anonymous inner class. They applied when there is a need to override a method or an interface.
On the other hand sub classes contains a different file which is in another package having the additional methods of their parent class. It inherits the methods and functions of their parent class and used is – a relationship whereas the child class is a parent class and so on.