In order to try and explain the important topic of polymorphism in Java, I will use the following class hierarchy as an example:
1 2 3 4 5 6 7 |
class Device { } class MobileDevice extends Device {} class DesktopDevice extends Device {} class WearableDevice extends Device {} |
Given this class hierarchy, what could we say about MobileDevice? It’s a descendant from Device (and implicitly from Object) so we could say: A MobileDevice is a ..Continue Reading