October 2017
Beginner
318 pages
7h 26m
English
When we declare that a subclass has a method that's identical to one of its superclass methods, we've overridden the superclass method. When we do this, it's a good idea to use the Java Override indicator:
@Override public void Print()
This is an indicator to future coders and some more arcane elements of our compiling suite that this particular method, given in the preceding screenshot, is hiding a method beneath it. When we actually run our code, Java gives preference to the lowest or subclassed version of a method.
So let's see whether we've declared our Poem and Literature relationship successfully. Let's go back to the main method of our program in the Inheritence.java class and see whether the poem portion of this program ...
Read now
Unlock full access